From 72502154725594cf31878aa944f4bc9d9f3521a3 Mon Sep 17 00:00:00 2001 From: transtrike Date: Tue, 16 Feb 2021 18:07:51 +0200 Subject: UserManager&RoleManager logic moved to Repo; Password hashing and validation moved to Repo and using ASPNET Core hashing methods; Added Migrations; Fixed Roles not added to user --- .../Configurations/Extensions/ConfigureDatabase.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Web/DevHive.Web/Configurations/Extensions') diff --git a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs index 84108ae..687e83f 100644 --- a/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs +++ b/src/Web/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs @@ -60,7 +60,7 @@ namespace DevHive.Web.Configurations.Extensions }); } - public static async Task UseDatabaseConfiguration(this IApplicationBuilder app) + public static void UseDatabaseConfiguration(this IApplicationBuilder app) { app.UseHttpsRedirection(); app.UseRouting(); @@ -75,21 +75,21 @@ namespace DevHive.Web.Configurations.Extensions var roleManager = (RoleManager)serviceScope.ServiceProvider.GetService(typeof(RoleManager)); - if (!await dbContext.Roles.AnyAsync(x => x.Name == Role.DefaultRole)) + if (!dbContext.Roles.Any(x => x.Name == Role.DefaultRole)) { Role defaultRole = new() { Name = Role.DefaultRole }; - await roleManager.CreateAsync(defaultRole); + roleManager.CreateAsync(defaultRole).Wait(); } - if (!await dbContext.Roles.AnyAsync(x => x.Name == Role.AdminRole)) + if (!dbContext.Roles.Any(x => x.Name == Role.AdminRole)) { Role adminRole = new() { Name = Role.AdminRole }; - await roleManager.CreateAsync(adminRole); + roleManager.CreateAsync(adminRole).Wait(); } - await dbContext.SaveChangesAsync(); + dbContext.SaveChanges(); } } } -- cgit v1.2.3