mirror of
https://github.com/correl/mage.git
synced 2025-04-07 17:00:08 -09:00
Changed that mailgun or smtp server can be used to send mails from server.
This commit is contained in:
parent
dcbe2da0e6
commit
75edce2295
1 changed files with 11 additions and 4 deletions
|
@ -99,7 +99,7 @@ public class MageServerImpl implements MageServer {
|
||||||
private static final Logger logger = Logger.getLogger(MageServerImpl.class);
|
private static final Logger logger = Logger.getLogger(MageServerImpl.class);
|
||||||
private static final ExecutorService callExecutor = ThreadExecutor.getInstance().getCallExecutor();
|
private static final ExecutorService callExecutor = ThreadExecutor.getInstance().getCallExecutor();
|
||||||
private static final SecureRandom RANDOM = new SecureRandom();
|
private static final SecureRandom RANDOM = new SecureRandom();
|
||||||
|
|
||||||
private final String adminPassword;
|
private final String adminPassword;
|
||||||
private final boolean testMode;
|
private final boolean testMode;
|
||||||
private final LinkedHashMap<String, String> activeAuthTokens = new LinkedHashMap<String, String>() {
|
private final LinkedHashMap<String, String> activeAuthTokens = new LinkedHashMap<String, String>() {
|
||||||
|
@ -140,9 +140,16 @@ public class MageServerImpl implements MageServer {
|
||||||
}
|
}
|
||||||
String authToken = generateAuthToken();
|
String authToken = generateAuthToken();
|
||||||
activeAuthTokens.put(email, authToken);
|
activeAuthTokens.put(email, authToken);
|
||||||
if (!MailClient.sendMessage(email, "XMage Password Reset Auth Token",
|
String subject = "XMage Password Reset Auth Token";
|
||||||
"Use this auth token to reset your password: " + authToken + "\n" +
|
String text = "Use this auth token to reset your password: " + authToken + "\n"
|
||||||
"It's valid until the next server restart.")) {
|
+ "It's valid until the next server restart.";
|
||||||
|
boolean success;
|
||||||
|
if (!ConfigSettings.getInstance().getMailUser().isEmpty()) {
|
||||||
|
success = MailClient.sendMessage(email, subject, text);
|
||||||
|
} else {
|
||||||
|
success = MailgunClient.sendMessage(email, subject, text);
|
||||||
|
}
|
||||||
|
if (!success) {
|
||||||
sendErrorMessageToClient(sessionId, "There was an error inside the server while emailing an auth token");
|
sendErrorMessageToClient(sessionId, "There was an error inside the server while emailing an auth token");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue