ChangePassword

What it does

Resets a user's password.

Definition

bool ChangePassword( string userName, string oldPassword, string newPassword );

Parameters

Name Type Description
userName string User name
oldPassword string Old password value (unencrypted)
newPassword string New password value

Sample code for calculating the password hash:

public static string GetPasswordHashWithSalt( string login, string password )
       {
           string salt = GetPasswordSha256Hash(login.ToUpper());
           return GetPasswordSha256Hash(password + salt);
       }
       private static string GetPasswordSha256Hash( string password )
       {
           Encoding enc = Encoding.GetEncoding("UTF-16");
           byte[] buffer = enc.GetBytes(password);
           var cryptoTransformSHA256 = new SHA256CryptoServiceProvider();
           string hash = BitConverter.ToString(cryptoTransformSHA256.ComputeHash(buffer)).Replace("-", "");
           return hash;
       }

Returned value

Type Description
bool
  • "false" if the password has not been reset. For example, the old password didn't match the new password
  • "true" if the password has been successfully reset

16.01.2023 10:02:51

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.