Compare commits

..

No commits in common. "628e0ad0346c440439bd744a3a10f08283b9932e" and "87caf24dd1865619ace7d8545b583e7ea734579a" have entirely different histories.

1 changed files with 14 additions and 9 deletions

View File

@ -970,6 +970,12 @@ namespace IRaCIS.Core.Application.Service
if (existUserLoginInfo.LastLoginIP != string.Empty) if (existUserLoginInfo.LastLoginIP != string.Empty)
{ {
// 与上一次区域不一致
if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
{
isLoginUncommonly = true;
//设置上次登录的IP //设置上次登录的IP
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser() await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser()
{ {
@ -978,14 +984,6 @@ namespace IRaCIS.Core.Application.Service
}); });
// 与上一次区域不一致
if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
{
isLoginUncommonly = true;
if (loginUser != null) if (loginUser != null)
{ {
//异地登录 //异地登录
@ -1020,6 +1018,13 @@ namespace IRaCIS.Core.Application.Service
} }
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.IdentityUserId, x => new IdentityUser()
{
LastLoginTime = DateTime.Now,
LastLoginIP = _userInfo.IP,
});
if (loginUser.Status == 0) if (loginUser.Status == 0)
{ {
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true); await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true);