パスワードを変更

動作

ユーザーのパスワードをリセットします。

定義

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

パラメータ/引数

名前 タイプ 説明
userName string ユーザー名
oldPassword string 以前のパスワード値(暗号化されていない)
newPassword string 新しいパスワード値

パスワードハッシュを計算するサンプルコード:

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;
       }

戻り値

タイプ 説明
bool
  • パスワードがリセットされていない場合は「false」となります例えば、以前のパスワードが新しいパスワードと一致しない場合です
  • パスワードが正常にリセットされた場合は「true」となります

25.05.2023 7:55:10

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.