public ActionResult ChangePassword(ChangePasswordModel model) { if (ModelState.IsValid) { if (MembershipService.ChangePassword(User.Identity.Name, model.OldPassword, model.NewPassword)) { return RedirectToAction("ChangePasswordSuccess"); } else { ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); } } // If we got this far, something failed, redisplay form ViewData["PasswordLength"] = MembershipService.MinPasswordLength; return View(model); }
public ActionResult ChangePassword(ChangePasswordModel model) { if (ModelState.IsValid) { if (UserMembership.ChangePwd(User.Identity.Name, model.OldPassword, model.NewPassword)) { return RedirectToAction("ChangePasswordSuccess"); } else { ModelState.AddModelError("", "Password corrente errata o nuova password non valida."); } } // If we got this far, something failed, redisplay form ViewData["PasswordLength"] = MIN_PWD_LEN; return View(model); }