mirror of https://github.com/jumpserver/jumpserver
perf: 异地登陆去掉本地判断
parent
fde118021e
commit
55775f0deb
|
@ -59,6 +59,10 @@ def check_different_city_login(user, request):
|
|||
else:
|
||||
city = get_ip_city(ip) or DEFAULT_CITY
|
||||
|
||||
last_user_login = UserLoginLog.objects.filter(username=user.username, status=True).first()
|
||||
if last_user_login and last_user_login.city != city:
|
||||
DifferentCityLoginMessage(user, ip, city).publish_async()
|
||||
city_white = ['LAN', ]
|
||||
if city not in city_white:
|
||||
last_user_login = UserLoginLog.objects.exclude(city__in=city_white) \
|
||||
.filter(username=user.username, status=True).first()
|
||||
|
||||
if last_user_login and last_user_login.city != city:
|
||||
DifferentCityLoginMessage(user, ip, city).publish_async()
|
||||
|
|
Loading…
Reference in New Issue