重置为复杂密码

This commit is contained in:
2024-09-06 14:13:03 +08:00
parent c1c5add001
commit 6c443ca089
7 changed files with 95 additions and 68 deletions
@@ -277,24 +277,10 @@ namespace IRaCIS.Application.Services
public async Task<IResponseOutput> ResetPassword(Guid userId)
{
var pwd = "123456";
var pwd = IRCEmailPasswordHelper.GenerateRandomPassword(10);
if (_hostEnvironment.EnvironmentName != "Development")
{
pwd = "Extimaging." + new Random().Next(100, 1000);
}
//try
//{
await _mailVerificationService.AdminResetPwdSendEmailAsync(userId, pwd);
//}
//catch (Exception)
//{
// //---请检查邮箱地址或者联系维护人员, 邮件发送失败, 未能创建账户成功
// throw new BusinessValidationFailedException(_localizer["User_CreateFailed"]);
//}
await _userRepository.UpdatePartialNowNoQueryAsync(userId, u => new User()
{
@@ -533,7 +519,7 @@ namespace IRaCIS.Application.Services
}
saveItem.Password = MD5Helper.Md5("123456");
saveItem.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10));
await _userRepository.AddAsync(saveItem);
@@ -646,7 +632,7 @@ namespace IRaCIS.Application.Services
await _mailVerificationService.SenMFAVerifyEmail(userId, userInfo.FullName, userInfo.EMail, verificationCode, (UserMFAType)mfaType);
var hiddenEmail = EmailMaskHelper.MaskEmail(userInfo.EMail);
var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(userInfo.EMail);
return ResponseOutput.Ok(hiddenEmail);
}