0

私はASP.Net IDを使用しています。 changepasswordasync関数で無効な古いパスワードがアカウントのロックアウトを引き起こさない場合、これを実行するにはどうしますか?これは、ペンテストでは問題が少ないと提起されました。ASP.Net Identity Changeパスワードアカウントのロックアウトが機能しない

よろしく

マイク

+1

こんにちは、マイク、あなたはApplicationUserManager.csで真の「UserLockoutEnabledByDefault」の値を設定していますファイル? – ArslanIqbal

+0

とMaxFailedAccessAttemptsBeforeLockoutを考慮する必要があります – netfed

+0

私はユーザーのロックアウトがログインのためにうまく動作することを言及する必要があります。これは私が上記のセットを持っていることを意味しますか? –

答えて

0

あなたはロックアウト機能を呼び出すことによってこれを行うことができ、ユーザが間違った古いパスワードを提供する場合

int userId = User.Identity.GetUserId(); 
IdentityResult result = await UserManager.ChangePasswordAsync(userId , model.OldPassword, model.NewPassword); 
if (result.Succeeded) 
{ 
    userManager.ResetAccessFailedCount(userId); 
} 
else 
{ 
    //you can add logic if the call didn't succeeded because of incorrect old 
    password and then execute the following line 
    userManager.AccessFailed(userId); 
} 
関連する問題