修改密码逻辑
continuous-integration/drone/push Build is passing Details

Uat_IRC_Net8
hang 2025-01-20 19:53:54 +08:00
parent 7d419595ca
commit 7ec274fb72
1 changed files with 17 additions and 14 deletions

View File

@ -7,6 +7,7 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service.OAuth;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using MassTransit;
@ -106,21 +107,7 @@ namespace IRaCIS.Core.Application.Service
}
if (oldPwd == null)
{
oldPwd = await _identityUserRepository.Where(x => x.Id == identityUserId).Select(x => x.Password).FirstOrDefaultAsync();
}
if (oldPwd.IsNotNullOrEmpty())
{
await _userPassWordLogRepository.AddAsync(new UserPassWordLog()
{
CreateTime = DateTime.Now,
PassWord = oldPwd!,
IdentityUserId = identityUserId,
});
}
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == identityUserId, x => new IdentityUser()
{
@ -413,6 +400,14 @@ namespace IRaCIS.Core.Application.Service
IsFirstAdd = false
});
await _userPassWordLogRepository.AddAsync(new UserPassWordLog()
{
CreateTime = DateTime.Now,
PassWord = newPwd,
IdentityUserId = identityUserId,
});
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.UnloginModifyPasswoed }, true);
@ -450,6 +445,14 @@ namespace IRaCIS.Core.Application.Service
IsFirstAdd = false
});
await _userPassWordLogRepository.AddAsync(new UserPassWordLog()
{
CreateTime = DateTime.Now,
PassWord = editPwModel.NewPassWord,
IdentityUserId = _userInfo.IdentityUserId,
});
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.LoginModifyPassword }, true);
return ResponseOutput.Result(success);