Skip to content
Snippets Groups Projects
Commit 0bd829bc authored by srosse's avatar srosse
Browse files

OO-4614: prefer mail to user name for some change password emails

Prefer the email of the user to its user name for the change password
email if the user name is a number and email is allowed for login
parent 0c478359
No related branches found
No related tags found
No related merge requests found
...@@ -267,19 +267,23 @@ public class PwChangeController extends BasicController { ...@@ -267,19 +267,23 @@ public class PwChangeController extends BasicController {
String today = DateFormat.getDateInstance(DateFormat.LONG, ureq.getLocale()).format(new Date()); String today = DateFormat.getDateInstance(DateFormat.LONG, ureq.getLocale()).format(new Date());
// mailer configuration // mailer configuration
String serverpath = Settings.getServerContextPathURI(); String serverpath = Settings.getServerContextPathURI();
String userName = identity.getName();
if(StringHelper.isLong(userName) && loginModule.isAllowLoginUsingEmail()) {
userName = emailAdress;
}
TemporaryKey tk = rm.createAndDeleteOldTemporaryKey(identity.getKey(), emailAdress, ip, TemporaryKey tk = rm.createAndDeleteOldTemporaryKey(identity.getKey(), emailAdress, ip,
RegistrationManager.PW_CHANGE, loginModule.getValidUntilHoursGui()); RegistrationManager.PW_CHANGE, loginModule.getValidUntilHoursGui());
myContent.contextPut("pwKey", tk.getRegistrationKey()); myContent.contextPut("pwKey", tk.getRegistrationKey());
StringBuilder body = new StringBuilder(); StringBuilder body = new StringBuilder(2048);
body.append("<style>") body.append("<style>")
.append(".o_footer {background: #FAFAFA; border: 1px solid #eee; border-radius: 5px; padding: 1em; margin: 1em;}") .append(".o_footer {background: #FAFAFA; border: 1px solid #eee; border-radius: 5px; padding: 1em; margin: 1em;}")
.append(".o_body {background: #FAFAFA; padding: 1em; margin: 1em;}") .append(".o_body {background: #FAFAFA; padding: 1em; margin: 1em;}")
.append("</style>") .append("</style>")
.append("<div class='o_body'>") .append("<div class='o_body'>")
.append(userTrans.translate("pwchange.headline")) .append(userTrans.translate("pwchange.headline"))
.append(userTrans.translate("pwchange.intro", new String[] { identity.getName() })) .append(userTrans.translate("pwchange.intro", new String[] { userName, identity.getName(), emailAdress }))
.append(userTrans.translate("pwchange.body", new String[] { serverpath, tk.getRegistrationKey(), i18nModule.getLocaleKey(ureq.getLocale()) })) .append(userTrans.translate("pwchange.body", new String[] { serverpath, tk.getRegistrationKey(), i18nModule.getLocaleKey(ureq.getLocale()) }))
.append(userTrans.translate("pwchange.body.alt", new String[] { serverpath, tk.getRegistrationKey(), i18nModule.getLocaleKey(ureq.getLocale()) })) .append(userTrans.translate("pwchange.body.alt", new String[] { serverpath, tk.getRegistrationKey(), i18nModule.getLocaleKey(ureq.getLocale()) }))
.append("</div>") .append("</div>")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment