How to Configure ASP.NET Core Identity password policy
By FoxLearn 2/18/2024 9:39:53 AM 159
This post shows you 'How to Configure ASP.NET Core Identity password policy require at least one special character, one uppercase letter, one number...etc'
Opening your Startup class, then configure the identity settings in your startup class, like this.
services.Configure<IdentityOptions>(options => { options.Password.RequireDigit = false; options.Password.RequiredLength = 3; options.Password.RequireLowercase = true; options.Password.RequireNonLetterOrDigit = true; options.Password.RequireUppercase = false; });
You can also configure identity when you add it as shown below.
services.AddIdentity<IdentityUser, IdentityRole>(options=> { options.Password.RequireDigit = false; options.Password.RequiredLength = 3; options.Password.RequireNonAlphanumeric = false; options.Password.RequireUppercase = false; options.Password.RequireLowercase = false; }).AddEntityFrameworkStores<ApplicationDbContext>().AddDefaultTokenProviders();
- Getting Started with ASP.NET Core 3.0
- How to fix 'Authorization in ASP.NET Core' with 401 Unauthorized
- The name 'Session' does not exist in the current context
- How to create a Toast Notifications in ASP.NET Core
- How to Minify HTML using WebMarkupMin in ASP.NET Core
- How to fix 'IMvcBuilder' does not contain a definition for 'AddNewtonsoftJson'
- How to fix System.InvalidOperationException: Scheme already exists: Identity.Application
- How to fix 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer'
Categories
Popular Posts
How to sign a powershell script
10/03/2024
How to get Credentials in PowerShell?
10/03/2024
How to implement Jint in C#
09/14/2024