public ActionResult ChangePassword(ChangePasswordModel model) { if (ModelState.IsValid) { //we need the username for this to work so get the user. User user = UserRepository.GetUser(_db, FormsAuthService.GetCurrentUserId()); if (MembershipService.ChangePassword(user.Username, model.OldPassword, model.NewPassword)) { return(RedirectToAction("ChangePasswordSuccess")); } else { ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); this.FlashValidationSummaryErrors(); } } else { this.FlashValidationSummaryErrors(); } // If we got this far, something failed, redisplay form return(View(model)); }
//Logout public ActionResult Logout() { _log.LogIt(FormsAuthService.GetCurrentUserId(), "Logged out"); FormsAuthService.SignOut(); return(RedirectToAction("Index", "Home")); }