mirror of https://github.com/jumpserver/jumpserver
fix: 修复用户最后登录禁用
parent
d96b220619
commit
e3cbaa52d5
|
@ -88,8 +88,8 @@ def check_unused_users():
|
||||||
uncommon_users_ttl = settings.SECURITY_UNCOMMON_USERS_TTL
|
uncommon_users_ttl = settings.SECURITY_UNCOMMON_USERS_TTL
|
||||||
seconds_to_subtract = uncommon_users_ttl * 24 * 60 * 60
|
seconds_to_subtract = uncommon_users_ttl * 24 * 60 * 60
|
||||||
t = timezone.now() - timedelta(seconds=seconds_to_subtract)
|
t = timezone.now() - timedelta(seconds=seconds_to_subtract)
|
||||||
last_login_q = Q(last_login__lte=t) | Q(last_login__isnull=True)
|
last_login_q = Q(last_login__lte=t) | (Q(last_login__isnull=True) & Q(date_joined__lte=t))
|
||||||
api_key_q = Q(date_api_key_last_used__lte=t) | Q(date_api_key_last_used__isnull=True)
|
api_key_q = Q(date_api_key_last_used__lte=t) | (Q(date_api_key_last_used__isnull=True) & Q(date_joined__lte=t))
|
||||||
|
|
||||||
users = User.objects \
|
users = User.objects \
|
||||||
.filter(date_joined__lt=t) \
|
.filter(date_joined__lt=t) \
|
||||||
|
|
Loading…
Reference in New Issue