@Resource
private EmailService emailService;
@RequestMapping(value = "/sendUpdatePasswordEmail", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json; charset=UTF-8")
public String sendUpdatePasswordEmail(String email, HttpServletRequest request, RedirectAttributes redirectAttributes) throws MalformedURLException, UnsupportedEncodingException {
User user = userDAO.findByEmail(email);
if (user != null) {
user.setOneTimeToken(uuidFactory.generateUUID());
userDAO.save(user);
emailService.sendUpdatePasswordMessage(user, request);
}
redirectAttributes.addFlashAttribute("message", "An email has been sent to " + email + " with a link to create your password and login");
redirectAttributes.addFlashAttribute("title", "Message Sent");