use of org.summerb.approaches.springmvc.security.dto.PasswordReset in project summerb by skarpushin.
the class LoginController method getPasswordResetForm.
@RequestMapping(method = RequestMethod.GET, value = SecurityActionsUrlsProviderDefaultImpl.RESET_PASSWORD)
public String getPasswordResetForm(@PathVariable(ATTR_PASSWORD_RESET_TOKEN) String passwordResetToken, @RequestParam(User.FN_EMAIL) String email, Model model, HttpServletRequest request) throws UserNotFoundException, FieldValidationException, GenericException {
// Check if token valid
if (!usersServiceFacade.isPasswordResetTokenValid(email, passwordResetToken)) {
auditEvents.report(AUDIT_PASSWORD_RESET_TOKEN_INVALID, ScalarValue.forV(passwordResetToken));
throw new GenericException(SecurityMessageCodes.INVALID_PASSWORD_RESET_TOKEN);
}
// Now let's show password reset form
model.addAttribute(ATTR_PASSWORD_RESET, new PasswordReset());
model.addAttribute(User.FN_EMAIL, email);
model.addAttribute(ATTR_PASSWORD_RESET_TOKEN, passwordResetToken);
return views.resetPassword();
}
Aggregations