Skip to content

Commit cc009f0

Browse files
authored
Merge pull request #331 from liangshiw/pr/fix330
fix #330
2 parents f2deb3b + 7b8f7ce commit cc009f0

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +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-
adminUser.Password = _passwordHasher.HashPassword(adminUser, User.DefaultPassword);
85-
CheckErrors(await _userManager.CreateAsync(adminUser));
84+
CheckErrors(await _userManager.CreateAsync(adminUser, User.DefaultPassword));
8685
await CurrentUnitOfWork.SaveChangesAsync(); // To get admin user's id
8786

8887
// Assign admin user to role!

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ public override async Task<UserDto> Create(CreateUserDto input)
4848
var user = ObjectMapper.Map<User>(input);
4949

5050
user.TenantId = AbpSession.TenantId;
51-
user.Password = _passwordHasher.HashPassword(user, input.Password);
5251
user.IsEmailConfirmed = true;
5352

54-
CheckErrors(await _userManager.CreateAsync(user));
53+
CheckErrors(await _userManager.CreateAsync(user, input.Password));
5554

5655
if (input.RoleNames != null)
5756
{

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,13 @@ public async Task<User> RegisterAsync(string name, string surname, string emailA
5656
};
5757

5858
user.SetNormalizedNames();
59-
60-
user.Password = _passwordHasher.HashPassword(user, plainPassword);
61-
59+
6260
foreach (var defaultRole in await _roleManager.Roles.Where(r => r.IsDefault).ToListAsync())
6361
{
6462
user.Roles.Add(new UserRole(tenant.Id, user.Id, defaultRole.Id));
6563
}
6664

67-
CheckErrors(await _userManager.CreateAsync(user));
65+
CheckErrors(await _userManager.CreateAsync(user, plainPassword));
6866
await CurrentUnitOfWork.SaveChangesAsync();
6967

7068
return user;

0 commit comments

Comments
 (0)