summaryrefslogtreecommitdiff
path: root/Program.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-03-07 08:18:01 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-03-07 08:18:01 +0300
commit45af463dbe359332967c75e4fdb8ab50e2d9e847 (patch)
tree3acf3cfe57dbf5d4fb7bf0fd01207677e0d3de95 /Program.cs
parent0c4d13caed53b2702eef41461d0c8a4b25df48f6 (diff)
Create admin user seed
Diffstat (limited to 'Program.cs')
-rw-r--r--Program.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Program.cs b/Program.cs
index eda78fa..cfc572a 100644
--- a/Program.cs
+++ b/Program.cs
@@ -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