打开后端正式环境验证
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-07-10 10:48:20 +08:00
parent 0ba439e5bd
commit 4b15bcdc55
1 changed files with 29 additions and 25 deletions

View File

@ -100,6 +100,8 @@ namespace IRaCIS.Application.Services
{ {
//var dbUser = (await _userRepository.FirstOrDefaultAsync(t => t.Id == userId)).IfNullThrowException(); //var dbUser = (await _userRepository.FirstOrDefaultAsync(t => t.Id == userId)).IfNullThrowException();
if (_verifyConfig.CurrentValue.OpenUserComplexPassword)
{
if (oldPwd != null && oldPwd == newPwd) if (oldPwd != null && oldPwd == newPwd)
{ {
//---新密码与旧密码相同。 //---新密码与旧密码相同。
@ -122,10 +124,14 @@ namespace IRaCIS.Application.Services
} }
var passWordList = await _userPassWordLogRepository.Where(x => x.UserId == userId).OrderByDescending(x => x.CreateTime).Take(2).ToListAsync(); var passWordList = await _userPassWordLogRepository.Where(x => x.UserId == userId).OrderByDescending(x => x.CreateTime).Take(2).ToListAsync();
if (passWordList.Any(x => x.PassWord == newPwd)) if (passWordList.Any(x => x.PassWord == newPwd))
{ {
throw new BusinessValidationFailedException(_localizer["User_PassWordRepeat"]); throw new BusinessValidationFailedException(_localizer["User_PassWordRepeat"]);
} }
}
if (oldPwd != null) if (oldPwd != null)
{ {
await _userPassWordLogRepository.AddAsync(new UserPassWordLog() await _userPassWordLogRepository.AddAsync(new UserPassWordLog()
@ -137,7 +143,6 @@ namespace IRaCIS.Application.Services
}); });
} }
await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == userId, x => new User() await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == userId, x => new User()
{ {
LastChangePassWordTime = DateTime.Now, LastChangePassWordTime = DateTime.Now,
@ -145,7 +150,6 @@ namespace IRaCIS.Application.Services
await _userPassWordLogRepository.SaveChangesAsync(); await _userPassWordLogRepository.SaveChangesAsync();
await Task.CompletedTask;
} }