public ActionResult ChangePassword(ChangePasswordModel changePassword)
        {
            if (ModelState.IsValid)
            {
                Account.ChangePassword(changePassword.NewPassword);

                FormsAuthentication.SignOut();
                return RedirectToAction("Index", "Home");
            }

            return View(changePassword);
        }
示例#2
0
        public ActionResult ChangePassword(ChangePasswordModel changePassword)
        {
            if (ModelState.IsValid)
            {

                var account = _unitOfWork.Accounts.GetCurrentUserAccount();
                var salt = Helper.CreateSalt();
                account.SetSalt(salt);
                account.GenerateNewPassword(changePassword.NewPassword, salt);
                _unitOfWork.Accounts.Edit(account);
                _unitOfWork.Complete();

                FormsAuthentication.SignOut();
                return RedirectToAction("Index", "Home");
            }

            return View(changePassword);
        }