mirror of https://github.com/jumpserver/jumpserver
perf: 优化用户不活跃检测
parent
8801003461
commit
01fcdad489
|
@ -503,7 +503,7 @@ class Config(dict):
|
|||
'SECURITY_LUNA_REMEMBER_AUTH': True,
|
||||
'SECURITY_WATERMARK_ENABLED': True,
|
||||
'SECURITY_MFA_VERIFY_TTL': 3600,
|
||||
'SECURITY_UNCOMMON_USERS_TTL': 90,
|
||||
'SECURITY_UNCOMMON_USERS_TTL': 999,
|
||||
'VERIFY_CODE_TTL': 60,
|
||||
'SECURITY_SESSION_SHARE': True,
|
||||
'SECURITY_CHECK_DIFFERENT_CITY_LOGIN': True,
|
||||
|
|
|
@ -86,6 +86,13 @@ def check_user_expired_periodic():
|
|||
@tmp_to_root_org()
|
||||
def check_unused_users():
|
||||
uncommon_users_ttl = settings.SECURITY_UNCOMMON_USERS_TTL
|
||||
if not uncommon_users_ttl or not uncommon_users_ttl.isdigit():
|
||||
return
|
||||
|
||||
uncommon_users_ttl = int(uncommon_users_ttl)
|
||||
if uncommon_users_ttl <= 0 or uncommon_users_ttl >= 999:
|
||||
return
|
||||
|
||||
seconds_to_subtract = uncommon_users_ttl * 24 * 60 * 60
|
||||
t = timezone.now() - timedelta(seconds=seconds_to_subtract)
|
||||
last_login_q = Q(last_login__lte=t) | (Q(last_login__isnull=True) & Q(date_joined__lte=t))
|
||||
|
|
Loading…
Reference in New Issue