Skip to content

Commit 288e359

Browse files
fix #332 call UserManager.InitializeOptionsAsync(tenantId);
Call UserManager.InitializeOptionsAsync(tenantId); override the identity default specification fix #332
1 parent cc009f0 commit 288e359

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/MultiTenancy/TenantAppService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public override async Task<TenantDto> Create(CreateTenantDto input)
8181

8282
// Create admin user for the tenant
8383
var adminUser = User.CreateTenantAdminUser(tenant.Id, input.AdminEmailAddress);
84+
await _userManager.InitializeOptionsAsync(tenant.Id);
8485
CheckErrors(await _userManager.CreateAsync(adminUser, User.DefaultPassword));
8586
await CurrentUnitOfWork.SaveChangesAsync(); // To get admin user's id
8687

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Users/UserAppService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public override async Task<UserDto> Create(CreateUserDto input)
5050
user.TenantId = AbpSession.TenantId;
5151
user.IsEmailConfirmed = true;
5252

53+
await _userManager.InitializeOptionsAsync(AbpSession.TenantId);
54+
5355
CheckErrors(await _userManager.CreateAsync(user, input.Password));
5456

5557
if (input.RoleNames != null)

aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Authorization/Users/UserRegistrationManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public async Task<User> RegisterAsync(string name, string surname, string emailA
6262
user.Roles.Add(new UserRole(tenant.Id, user.Id, defaultRole.Id));
6363
}
6464

65+
await _userManager.InitializeOptionsAsync(tenant.Id);
66+
6567
CheckErrors(await _userManager.CreateAsync(user, plainPassword));
6668
await CurrentUnitOfWork.SaveChangesAsync();
6769

0 commit comments

Comments
 (0)