From 496903dfb2a654eba197c1873e21b3676cabbd72 Mon Sep 17 00:00:00 2001 From: jiangweidong <1053570670@qq.com> Date: Thu, 13 Jun 2024 11:06:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E5=90=8E=E7=AB=AF=E7=9A=84?= =?UTF-8?q?session=5Fkey=E6=9C=89=E4=B8=A4=E7=A7=8D=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/signal_handlers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/authentication/signal_handlers.py b/apps/authentication/signal_handlers.py index e060e3c1f..c74c3c7ed 100644 --- a/apps/authentication/signal_handlers.py +++ b/apps/authentication/signal_handlers.py @@ -1,5 +1,5 @@ from django.conf import settings -from django.contrib.auth import user_logged_in +from django.contrib.auth import user_logged_in, BACKEND_SESSION_KEY from django.core.cache import cache from django.dispatch import receiver from django_cas_ng.signals import cas_user_authenticated @@ -20,8 +20,9 @@ def on_user_auth_login_success(sender, user, request, **kwargs): and user.mfa_enabled \ and not request.session.get('auth_mfa'): request.session['auth_mfa_required'] = 1 + auth_backend = request.session.get('auth_backend', request.session.get(BACKEND_SESSION_KEY)) if not request.session.get("auth_third_party_done") and \ - request.session.get('auth_backend') in AUTHENTICATION_BACKENDS_THIRD_PARTY: + auth_backend in AUTHENTICATION_BACKENDS_THIRD_PARTY: request.session['auth_third_party_required'] = 1 user_session_id = request.session.get('user_session_id')