|
|
@ -137,7 +137,11 @@ public class MultiController extends MultiActionController { |
|
|
|
return new ModelAndView("recover", "model", map); |
|
|
|
return new ModelAndView("recover", "model", map); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* e-mail user new password via configured SMTP server |
|
|
|
|
|
|
|
*/ |
|
|
|
private boolean emailPassword(String password, String username, String email) { |
|
|
|
private boolean emailPassword(String password, String username, String email) { |
|
|
|
|
|
|
|
/* Default to protocol smtp when SMTPEncryption is set to "None" */ |
|
|
|
String prot = "smtp"; |
|
|
|
String prot = "smtp"; |
|
|
|
|
|
|
|
|
|
|
|
if (settingsService.getSMTPServer() == null || settingsService.getSMTPServer().isEmpty()) { |
|
|
|
if (settingsService.getSMTPServer() == null || settingsService.getSMTPServer().isEmpty()) { |
|
|
@ -155,6 +159,7 @@ public class MultiController extends MultiActionController { |
|
|
|
} |
|
|
|
} |
|
|
|
props.put("mail." + prot + ".host", settingsService.getSMTPServer()); |
|
|
|
props.put("mail." + prot + ".host", settingsService.getSMTPServer()); |
|
|
|
props.put("mail." + prot + ".port", settingsService.getSMTPPort()); |
|
|
|
props.put("mail." + prot + ".port", settingsService.getSMTPPort()); |
|
|
|
|
|
|
|
/* use authentication when SMTPUser is configured */ |
|
|
|
if (settingsService.getSMTPUser() != null && !settingsService.getSMTPUser().isEmpty()) { |
|
|
|
if (settingsService.getSMTPUser() != null && !settingsService.getSMTPUser().isEmpty()) { |
|
|
|
props.put("mail." + prot + ".auth", "true"); |
|
|
|
props.put("mail." + prot + ".auth", "true"); |
|
|
|
} |
|
|
|
} |
|
|
@ -177,10 +182,10 @@ public class MultiController extends MultiActionController { |
|
|
|
|
|
|
|
|
|
|
|
Transport trans = session.getTransport(prot); |
|
|
|
Transport trans = session.getTransport(prot); |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (settingsService.getSMTPUser() != null && !settingsService.getSMTPUser().isEmpty()) { |
|
|
|
if (props.get("mail." + prot + ".auth").equals("true")) { |
|
|
|
trans.connect(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
trans.connect(settingsService.getSMTPServer(), settingsService.getSMTPUser(), settingsService.getSMTPPassword()); |
|
|
|
trans.connect(settingsService.getSMTPServer(), settingsService.getSMTPUser(), settingsService.getSMTPPassword()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
trans.connect(); |
|
|
|
} |
|
|
|
} |
|
|
|
trans.sendMessage(message, message.getAllRecipients()); |
|
|
|
trans.sendMessage(message, message.getAllRecipients()); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|