> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ChangePassword

> ABBYY FlexiCapture のユーザー管理 API の ChangePassword メソッドは、ユーザーのパスワードをリセットします。ソルト付き SHA-256 パスワードハッシュを計算するコード例も含まれています。

<div id="what-it-does">
  ## 機能
</div>

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

<div id="definition">
  ## 定義
</div>

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

<div id="parameters">
  ## パラメーター
</div>

| **名前**      | **型**  | **説明**          |
| ----------- | ------ | --------------- |
| 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;
        }
```

<div id="returned-value">
  ## 戻り値
</div>

<table width="100%"><tbody><tr><td><p><strong>型</strong></p></td><td><p><strong>説明</strong></p></td></tr><tr><td><p>bool</p></td><td><ul><li>パスワードがリセットされなかった場合は "false"。たとえば、古いパスワードが新しいパスワードと一致しない場合です</li><li>パスワードが正常にリセットされた場合は "true"</li></ul></td></tr></tbody></table>
