修改密码逻辑
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7d419595ca
commit
7ec274fb72
|
@ -7,6 +7,7 @@ using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.Service.OAuth;
|
using IRaCIS.Core.Application.Service.OAuth;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using MassTransit;
|
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()
|
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == identityUserId, x => new IdentityUser()
|
||||||
{
|
{
|
||||||
|
@ -413,6 +400,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
IsFirstAdd = false
|
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);
|
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
|
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);
|
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);
|
return ResponseOutput.Result(success);
|
||||||
|
|
Loading…
Reference in New Issue