feat 增加密码重置功能
This commit is contained in:
@@ -158,4 +158,19 @@ public class UserService : IUserService
|
||||
.Where(x => x.ClaimType == "tenants")
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task ResetPasswordAsync(UserResetPasswordRequest request)
|
||||
{
|
||||
request.Password ??= "123456";
|
||||
var user = await _identityDbContext.Queryable<UserEntity>().SingleAsync(x => x.Id == request.UserId);
|
||||
if (user != null)
|
||||
{
|
||||
var hasher = new PasswordHasher<UserEntity>();
|
||||
var password = hasher.HashPassword(user, request.Password);
|
||||
user.PasswordHash = password;
|
||||
|
||||
await _identityDbContext.UpdateAsync(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user