resource.getLocale(), "Jahia User Registration");
json.put("message", message);
return new ActionResult(HttpServletResponse.SC_OK, null, json);
}
JahiaUser user = userManagerService.lookupUser(username);
if (user == null ) {
JSONObject json = new JSONObject();
String message = JahiaResourceBundle.getString("JahiaUserRegistration", "passwordrecovery.username.invalid",
resource.getLocale(), "Jahia User Registration");
json.put("message", message);
return new ActionResult(SC_OK, null, json);
}
String to = user.getProperty("j:email");
if (to == null || !MailService.isValidEmailAddress(to, false)) {
JSONObject json = new JSONObject();
String message = JahiaResourceBundle.getString("JahiaUserRegistration", "passwordrecovery.mail.invalid",
resource.getLocale(), "Jahia User Registration");
json.put("message", message);
return new ActionResult(SC_OK, null, json);
}
String from = SettingsBean.getInstance().getMail_from();
String authKey = DigestUtils.md5Hex(username + System.currentTimeMillis());
req.getSession().setAttribute("passwordRecoveryToken", new PasswordToken(authKey, user.getLocalPath()));
Map<String,Object> bindings = new HashMap<String,Object>();
bindings.put("link", req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() +
Jahia.getContextPath() + Render.getRenderServletPath() + "/live/"
+ resource.getLocale().getLanguage() + resource.getNode().getPath() + ".html?key=" + authKey);