BinaryStudio.TaskManager.Logic.Core.UserProcessor.ChangePassword C# (CSharp) Метод

ChangePassword() публичный Метод

The change password.
public ChangePassword ( int userId, string oldPassword, string newPassword ) : bool
userId int /// The user id. ///
oldPassword string /// The old password. ///
newPassword string /// The new password. ///
Результат bool
        public bool ChangePassword(int userId, string oldPassword, string newPassword)
        {
            var user = this.userRepository.GetById(userId);
            if (this.cryptoProvider.ComparePassword(user.Credentials.Passwordhash, user.Credentials.Salt, oldPassword))
            {
                user.Credentials.Passwordhash = this.cryptoProvider.CreateCryptoPassword(
                    newPassword, user.Credentials.Salt);
                this.userRepository.UpdateUser(user);
                return true;
            }

            return false;
        }