* @param errors
* @return the return view
* @throws ServiceException
*/
public String processResetPassword(ResetPasswordForm resetPasswordForm, HttpServletRequest request, HttpServletResponse response, Model model, BindingResult errors) throws ServiceException {
GenericResponse errorResponse = new GenericResponse();
resetPasswordValidator.validate(resetPasswordForm.getUsername(), resetPasswordForm.getPassword(), resetPasswordForm.getPasswordConfirm(), errors);
if (errorResponse.getHasErrors()) {
return getResetPasswordView();
}
errorResponse = customerService.resetPasswordUsingToken(
resetPasswordForm.getUsername(),
resetPasswordForm.getToken(),
resetPasswordForm.getPassword(),
resetPasswordForm.getPasswordConfirm());
if (errorResponse.getHasErrors()) {
String errorCode = errorResponse.getErrorCodesList().get(0);
request.setAttribute("errorCode", errorCode);
return getResetPasswordView();
} else {
// The reset password was successful, so log this customer in.
loginService.loginCustomer(resetPasswordForm.getUsername(), resetPasswordForm.getPassword());