fix: relogin重置MFA_VERIFY_TIME (#8348)

Co-authored-by: feng626 <1304903146@qq.com>
pull/8353/head
fit2bot 2022-06-08 19:32:50 +08:00 committed by GitHub
parent c6949b4f68
commit 81ef614820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
#
import time
from django.db.models.signals import (
post_save, m2m_changed, pre_delete
)
@ -275,6 +277,7 @@ def on_user_auth_success(sender, user, request, login_type=None, **kwargs):
check_different_city_login_if_need(user, request)
data = generate_data(user.username, request, login_type=login_type)
request.session['login_time'] = data['datetime'].strftime("%Y-%m-%d %H:%M:%S")
request.session["MFA_VERIFY_TIME"] = int(time.time())
data.update({'mfa': int(user.mfa_enabled), 'status': True})
write_login_log(**data)