修改IP
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-08-16 15:38:15 +08:00
parent a540326031
commit 6b536f4a4f
1 changed files with 4 additions and 4 deletions

View File

@ -806,12 +806,14 @@ namespace IRaCIS.Application.Services
//登录成功 清除缓存 //登录成功 清除缓存
_cache.Set(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes)); _cache.Set(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes));
var ipinfo = _searcher.Search(_userInfo.IP);
var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
if (loginUser.LastLoginIP != string.Empty) if (loginUser.LastLoginIP != string.Empty)
{ {
// 与上一次IP不一致 // 与上一次IP不一致
if (loginUser.LastLoginIP != _userInfo.IP) if (loginUser.LastLoginIP != iPRegion)
{ {
loginUser.LoginState = 2; loginUser.LoginState = 2;
} }
@ -832,9 +834,7 @@ namespace IRaCIS.Application.Services
}); });
} }
var ipinfo = _searcher.Search(_userInfo.IP);
var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new User() await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new User()
{ {
LastLoginIP = iPRegion, LastLoginIP = iPRegion,