Search in sources :

Example 1 with PasswordReset

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();
}
Also used : PasswordReset(org.summerb.approaches.springmvc.security.dto.PasswordReset) GenericException(org.summerb.utils.exceptions.GenericException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 PasswordReset (org.summerb.approaches.springmvc.security.dto.PasswordReset)1 GenericException (org.summerb.utils.exceptions.GenericException)1