public override bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            try
            {
                if (username == _UserStorage.GetCurrentUser().Username)
                {
                    _UserStorage.ChangePassword(new ChangePasswordModel {
                        NewPassword = newPassword, OldPassword = oldPassword
                    });

                    return(true);
                }
            }
            catch (Exception)
            {
            }

            return(false);
        }
示例#2
0
        public ActionResult ChangePassword(ChangePasswordModel changePasswordModel)
        {
            if (changePasswordModel.OldPassword != _Storage.GetCurrentUser().Password)
            {
                ModelState.AddModelError("OldPassword", "Pasword is not correct");
            }
            else if (changePasswordModel.NewPassword != changePasswordModel.ConfirmPassword)
            {
                ModelState.AddModelError("ConfirmPassword", "Paswords don't match");
            }

            if (!ModelState.IsValid)
            {
                return(View());
            }

            _Storage.ChangePassword(changePasswordModel);

            return(RedirectToAction("Index"));
        }
示例#3
0
        public async Task <OperationResult> ChangePassword(ChangePasswordVM changePasswordVM)
        {
            await _userStorage.ChangePassword(changePasswordVM);

            return(OperationResult.Success);
        }