Compare commits

..

2 Commits

Author SHA1 Message Date
hang 628e0ad034 修改异地登录bug 设置最后一次登录的iP
continuous-integration/drone/push Build is passing Details
2025-04-03 13:55:04 +08:00
hang 2f3f639918 修改异地登录ip逻辑 2025-04-03 13:55:00 +08:00
1 changed files with 9 additions and 14 deletions

View File

@ -970,12 +970,6 @@ 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()
{ {
@ -984,6 +978,14 @@ namespace IRaCIS.Core.Application.Service
}); });
// 与上一次区域不一致
if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
{
isLoginUncommonly = true;
if (loginUser != null) if (loginUser != null)
{ {
//异地登录 //异地登录
@ -1018,13 +1020,6 @@ 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);