How do I set password options in Aspnet Core 2.1

前端 未结 2 514
醉话见心
醉话见心 2021-01-18 07:57

I have followed the SO example code and the official documentation but however I change the password length in my Aspnet core 2.1 project nothing changes.
I always get t

2条回答
  •  没有蜡笔的小新
    2021-01-18 08:03

    These are all the option for the password: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-configuration?view=aspnetcore-2.2

    services.Configure(options =>
    {
        // Default Password settings.
        options.Password.RequireDigit = true;
        options.Password.RequireLowercase = true;
        options.Password.RequireNonAlphanumeric = true;
        options.Password.RequireUppercase = true;
        options.Password.RequiredLength = 6;
        options.Password.RequiredUniqueChars = 1;
    });
    

    To modify the rule see this How override ASP.NET Core Identity's password policy https://andrewlock.net/creating-custom-password-validators-for-asp-net-core-identity-2/

提交回复
热议问题