This version adds a kill switch for account creation.
This commit is contained in:
parent
d2671102d8
commit
f025d0754c
@ -59,6 +59,44 @@ public class electronicMailHandler {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void Onboardingdisabled(String receiverEmail, String User) {
|
||||||
|
//get date for email
|
||||||
|
Date date = new Date();
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
|
||||||
|
String Date = formatter.format(date);
|
||||||
|
//get time for sign in time
|
||||||
|
Date dt = new Date();
|
||||||
|
SimpleDateFormat dateFormat;
|
||||||
|
dateFormat = new SimpleDateFormat("kk:mm:ss");
|
||||||
|
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.put("mail.smtp.host", emailSMTPserver);
|
||||||
|
props.put("mail.smtp.socketFactory.port", emailSMTPPort);
|
||||||
|
props.put("mail.smtp.socketFactory.class",
|
||||||
|
"javax.net.ssl.SSLSocketFactory");
|
||||||
|
props.put("mail.smtp.auth", "true");
|
||||||
|
props.put("mail.smtp.port", emailSMTPPort);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Authenticator auth = new SMTPAuthenticator();
|
||||||
|
Session session = Session.getInstance(props, auth);
|
||||||
|
Message message = new MimeMessage(session);
|
||||||
|
message.setFrom(new InternetAddress(senderEmailId));
|
||||||
|
message.setRecipients(Message.RecipientType.TO,
|
||||||
|
InternetAddress.parse(receiverEmail));
|
||||||
|
message.setSubject("Obsidian Core Request Denial");
|
||||||
|
message.setText("Hey there, account creation has been disabled.\n" +
|
||||||
|
"We're closing up shop, and we've disabled account creation on the service. Existing accounts will continue to work until service shutdown." +
|
||||||
|
"\nHave a good day, " + User);
|
||||||
|
|
||||||
|
Transport.send(message);
|
||||||
|
System.out.println("Sent Disabled Account Join Email");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.err.println("Email ONBOARD Not sent due to an error");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public static void offBoarding(String receiverEmail, String User, String Name) {
|
public static void offBoarding(String receiverEmail, String User, String Name) {
|
||||||
//get date for email
|
//get date for email
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
@ -59,4 +59,13 @@ public class secureCalls {
|
|||||||
};
|
};
|
||||||
runnable.run();
|
runnable.run();
|
||||||
}
|
}
|
||||||
|
public static void accountCreationDisabled (String email, String user)
|
||||||
|
{
|
||||||
|
final Runnable runnable = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
electronicMailHandler.Onboardingdisabled(email,user);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1116,6 +1116,7 @@ public class delegationServices {
|
|||||||
String Password = (String) DServer.get("Password");
|
String Password = (String) DServer.get("Password");
|
||||||
String Email = (String) DServer.get("Email");
|
String Email = (String) DServer.get("Email");
|
||||||
String FName = (String) DServer.get("FName");
|
String FName = (String) DServer.get("FName");
|
||||||
|
if ((Boolean) Filter.get("creationEnabled")) {
|
||||||
String sourcet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
|
String sourcet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
|
||||||
StringBuilder sbt = new StringBuilder();
|
StringBuilder sbt = new StringBuilder();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
@ -1262,6 +1263,21 @@ public class delegationServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
BasicDBObject searchQuery = new BasicDBObject();
|
||||||
|
searchQuery.append("_id", ClientID);
|
||||||
|
secureCalls.accountCreationDisabled(Email, User);
|
||||||
|
BasicDBObject updateQuery = new BasicDBObject();
|
||||||
|
BasicDBObject updateQuery1 = new BasicDBObject();
|
||||||
|
updateQuery.append("$set",
|
||||||
|
new BasicDBObject().append("type", 52));
|
||||||
|
updateQuery1.append("$set",
|
||||||
|
new BasicDBObject().append("status", true));
|
||||||
|
dCollection.updateOne(searchQuery, updateQuery);
|
||||||
|
dCollection.updateOne(searchQuery, updateQuery1);
|
||||||
|
System.out.println("Update Request With Finished Status");
|
||||||
|
delegationTimer.DeleteTargetRequestByID(Lrequest.get("_id"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (requesttype == 20)
|
if (requesttype == 20)
|
||||||
//TODO rewrite to just need username, password will be set by system later
|
//TODO rewrite to just need username, password will be set by system later
|
||||||
|
Loading…
x
Reference in New Issue
Block a user