public ActionResult ResetPassword(ResetPasswordModel model) { if (ModelState.IsValid) { Boolean success = true; var user = userRepository.GetUserByUsername(model.UserName); if (user == null) { ModelState.AddModelError("", "The supplied details are invalid."); success = false; } else if (!MembershipService.ChangePassword(model.UserName, model.OldPassword, model.NewPassword)) { ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); success = false; } if (success) { FormsService.SignIn(model.UserName, false); model.Url = GetRedirectURL(model.UserName); return PartialView("ResetPasswordContainer", model); } } return PartialView("ResetPasswordContainer", model); }
public ActionResult ResetPassword() { ResetPasswordModel model = new ResetPasswordModel(); model.UserName = TempData["username"].ToString(); model.OldPassword = TempData["password"].ToString(); return View(model); }