public ActionResult PasswordResetRequest(string token) { var vmPasswordReset = new vmPasswordReset(); if (token == null) { throw new ArgumentNullException("token"); } var user = UserService.GetUserByPasswordResetToken(token); if (user != null) { vmPasswordReset.User = user; vmPasswordReset.ResetToken = token; return(View(vmPasswordReset)); } return(RedirectToAction("Index", "Home")); }
public ActionResult PasswordResetRequest(vmPasswordReset passwordReset) { var result = new ServiceResult(); if (passwordReset == null) { throw new ArgumentNullException("passwordReset"); } if (passwordReset.Password == passwordReset.ConfirmPassword && UserService.IsValidPasswordResetToken(passwordReset.ResetToken)) { var user = UserService.GetUserByPasswordResetToken(passwordReset.ResetToken); result = UserService.UpdatePassword(user.UserId, passwordReset.Password); if (result.Success) { return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("Service Error", "Failed to update Password. Please contact support."); return(View(passwordReset)); } ModelState.AddModelError("Password Mismatch", "Verify the passwords match"); return(View(passwordReset)); }