diff options
author | HombreLaser <sebastian-440@live.com> | 2022-11-18 16:32:38 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-11-18 16:32:38 -0600 |
commit | a640608ab8ff895be3125ebf75a4d3d19139f5c3 (patch) | |
tree | 5634b61500b4925bb07f918ec5780a93186bb89e /Models | |
parent | 22b5afd25bc29f920f46456c0a6acf6847a9af5e (diff) |
Añadido login de administradores
Diffstat (limited to 'Models')
-rw-r--r-- | Models/ApplicationDbContext.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Models/ApplicationDbContext.cs b/Models/ApplicationDbContext.cs index d2b8d26..eda476c 100644 --- a/Models/ApplicationDbContext.cs +++ b/Models/ApplicationDbContext.cs @@ -11,10 +11,10 @@ namespace BackendPIA.Models { protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); - Guid user_id = Guid.NewGuid(); - Guid role_id = Guid.NewGuid(); + string user_id = "24edc3d6-bf9c-41a1-9371-224e4419ccb0"; + string role_id = "d42006bc-7f69-4aa4-b247-eb9e2abfe0ec"; var hasher = new PasswordHasher<UserAccount>(); - UserAccount user_seed = new UserAccount { Id = user_id.ToString(), UserName = "admin", Email = "admin@example.com", + UserAccount user_seed = new UserAccount { Id = user_id, UserName = "admin", Email = "admin@example.com", NormalizedEmail = "ADMIN@EXAMPLE.COM", NormalizedUserName = "ADMIN" }; // TODO: save the seeded admin password in a user secret. user_seed.PasswordHash = hasher.HashPassword(user_seed, "admin_password"); @@ -22,10 +22,10 @@ namespace BackendPIA.Models { builder.Entity<IdentityRole>().HasData(new IdentityRole { Name = "Administrator", NormalizedName = "ADMINISTRATOR", - Id = role_id.ToString(), - ConcurrencyStamp = role_id.ToString() + Id = role_id, + ConcurrencyStamp = role_id }); - builder.Entity<IdentityUserRole<string>>().HasData(new IdentityUserRole<string> { UserId = user_id.ToString(), RoleId = role_id.ToString() }); + builder.Entity<IdentityUserRole<string>>().HasData(new IdentityUserRole<string> { UserId = user_id, RoleId = role_id }); } } } |