如果用户登录在Asp.Net Core标识中连续失败,如何禁用帐户

Hun*_*ach 2 c# asp.net-identity entity-framework-core asp.net-core asp.net-core-identity

目前,我在我的系统中使用Asp.net核心1.1,EF核心和Asp.net核心身份.我在startup.cs课堂上有一个配置密码策略.

是否有配置在用户连续登录失败时禁用帐户?

services.Configure<IdentityOptions>(options =>
{
    // Password settings
    options.Password.RequireDigit = true;
    options.Password.RequiredLength = 6;
    options.Password.RequireNonAlphanumeric = true;
    options.Password.RequireUppercase = true;
    options.Password.RequireLowercase = true;
}
Run Code Online (Sandbox Code Playgroud)

小智 7

你可以这样做

options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30);
options.Lockout.MaxFailedAccessAttempts = 5;
options.Lockout.AllowedForNewUsers = true;
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅此链接