From bd8a1a7d0e0a2f44e5e7ab20e154e9e4e4433065 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 15 Mar 2021 17:03:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DMFA=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98(=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E4=BF=AE=E6=94=B9session=E4=B8=ADauth=5Fbackend?= =?UTF-8?q?=E7=9A=84key=E5=AE=9E=E7=8E=B0;django.auth.get=5Fuser=E6=97=B6?= =?UTF-8?q?=E6=A0=A1=E9=AA=8Cbackends=E8=B7=AF=E5=BE=84=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E8=BF=94=E5=9B=9EAnonymousUser)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/signals_handlers.py | 7 +++---- apps/users/views/profile/otp.py | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/apps/authentication/signals_handlers.py b/apps/authentication/signals_handlers.py index ca06a0433..8e353ddf6 100644 --- a/apps/authentication/signals_handlers.py +++ b/apps/authentication/signals_handlers.py @@ -1,6 +1,5 @@ from importlib import import_module -from django.contrib.auth import BACKEND_SESSION_KEY from django.conf import settings from django.contrib.auth import user_logged_in from django.core.cache import cache @@ -25,17 +24,17 @@ def on_user_auth_login_success(sender, user, request, **kwargs): @receiver(openid_user_login_success) def on_oidc_user_login_success(sender, request, user, create=False, **kwargs): - request.session[BACKEND_SESSION_KEY] = 'OIDCAuthCodeBackend' + request.session['auth_backend'] = settings.AUTH_BACKEND_OIDC_CODE post_auth_success.send(sender, user=user, request=request) @receiver(openid_user_login_failed) def on_oidc_user_login_failed(sender, username, request, reason, **kwargs): - request.session[BACKEND_SESSION_KEY] = 'OIDCAuthCodeBackend' + request.session['auth_backend'] = settings.AUTH_BACKEND_OIDC_CODE post_auth_failed.send(sender, username=username, request=request, reason=reason) @receiver(cas_user_authenticated) def on_cas_user_login_success(sender, request, user, **kwargs): - request.session[BACKEND_SESSION_KEY] = 'CASBackend' + request.session['auth_backend'] = settings.AUTH_BACKEND_CAS post_auth_success.send(sender, user=user, request=request) diff --git a/apps/users/views/profile/otp.py b/apps/users/views/profile/otp.py index f0e938170..caed50532 100644 --- a/apps/users/views/profile/otp.py +++ b/apps/users/views/profile/otp.py @@ -51,9 +51,6 @@ class UserOtpEnableInstallAppView(TemplateView): return super().get_context_data(**kwargs) - - - class UserOtpEnableBindView(AuthMixin, TemplateView, FormView): template_name = 'users/user_otp_enable_bind.html' form_class = forms.UserCheckOtpCodeForm