perf: 异地登陆去掉本地判断

pull/7134/head
feng626 2021-11-02 15:41:25 +08:00 committed by 老广
parent fde118021e
commit 55775f0deb
1 changed files with 7 additions and 3 deletions

View File

@ -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()