Allows account migration
This commit is contained in:
@ -134,7 +134,49 @@ public class electronicMailHandler {
|
||||
e.printStackTrace();
|
||||
System.err.println("Was Not Sent Because Of An Error.");
|
||||
}
|
||||
} private static class SMTPAuthenticator extends
|
||||
|
||||
}
|
||||
public static void otkMigrate (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 Account Notice");
|
||||
message.setText("The migration process has been completed, and the key is no longer valid.\n" +
|
||||
"You will not receive a migration popup on login unless the account service changes hashes again.\n" +
|
||||
"Welcome back to your account, and have a great day!\n" +
|
||||
"\n\n\n\n\n" +
|
||||
" This email is automated, sent to the owner of the account (" + User + ")." + " Please don't reply to this email.");
|
||||
|
||||
Transport.send(message);
|
||||
System.out.println("Alert Sent");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println("Was Not Sent Because Of An Error.");
|
||||
}
|
||||
|
||||
}
|
||||
private static class SMTPAuthenticator extends
|
||||
javax.mail.Authenticator {
|
||||
public PasswordAuthentication
|
||||
getPasswordAuthentication() {
|
||||
|
@ -26,4 +26,13 @@ public class secureCalls {
|
||||
};
|
||||
runnable.run();
|
||||
}
|
||||
public static void accountMigrationComplete (String email, String user)
|
||||
{
|
||||
final Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
electronicMailHandler.otkMigrate(email, user);
|
||||
}
|
||||
};
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user