diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-03-07 08:18:01 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-03-07 08:18:01 +0300 |
commit | 45af463dbe359332967c75e4fdb8ab50e2d9e847 (patch) | |
tree | 3acf3cfe57dbf5d4fb7bf0fd01207677e0d3de95 /Program.cs | |
parent | 0c4d13caed53b2702eef41461d0c8a4b25df48f6 (diff) |
Create admin user seed
Diffstat (limited to 'Program.cs')
-rw-r--r-- | Program.cs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -17,6 +17,13 @@ builder.Services.AddDbContext<IdentityContext>(opts => builder.Services.AddIdentity<IdentityUser, IdentityRole>() .AddEntityFrameworkStores<IdentityContext>(); + +builder.Services.Configure<IdentityOptions>( opts => +{ + opts.Password.RequiredLength = 6; + opts.Password.RequireNonAlphanumeric = false; + opts.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyz"; +}); builder.Services.AddControllersWithViews(); @@ -28,5 +35,6 @@ app.MapDefaultControllerRoute(); app.UseAuthentication(); app.UseAuthorization(); +IdentitySeedData.CreateAdminAccount(app.Services, app.Configuration); app.Run();
\ No newline at end of file |