AssessmentAnywhere.Controllers.AccountController.ChangePassword C# (CSharp) Method

ChangePassword() private method

private ChangePassword ( ChangePasswordModel model ) : System.Web.Mvc.ActionResult
model AssessmentAnywhere.Models.Account.ChangePasswordModel
return System.Web.Mvc.ActionResult
        public ActionResult ChangePassword(ChangePasswordModel model)
        {
            if (ModelState.IsValid)
            {
                // ChangePassword will throw an exception rather
                // than return false in certain failure scenarios.
                bool changePasswordSucceeded;
                try
                {
                    var user = this.userRepo.OpenCurrentUser();
                    user.ChangePassword(model.NewPassword, model.OldPassword);
                    changePasswordSucceeded = true;
                }
                catch (Exception)
                {
                    changePasswordSucceeded = false;
                }

                if (changePasswordSucceeded)
                {
                    return this.RedirectToAction("ChangePasswordSuccess");
                }

                this.ModelState.AddModelError(
                    string.Empty, "The current password is incorrect or the new password is invalid.");
            }

            // If we got this far, something failed, redisplay form
            return this.View(model);
        }

Same methods

AccountController::ChangePassword ( ) : System.Web.Mvc.ActionResult