From cce34f49399496ef131317a548a4d60bfc03393f Mon Sep 17 00:00:00 2001 From: xinwen Date: Mon, 17 Jan 2022 15:45:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=EF=BC=8C=E7=99=BB=E9=99=86=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=B8=AD=E7=9A=84=E8=AE=A4=E8=AF=81=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/mixins.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/authentication/mixins.py b/apps/authentication/mixins.py index dd3653c6e..c74b1a5ff 100644 --- a/apps/authentication/mixins.py +++ b/apps/authentication/mixins.py @@ -455,7 +455,10 @@ class AuthMixin(CommonMixin, AuthPreCheckMixin, AuthACLMixin, MFAMixin, AuthPost ) if not user: self.raise_credential_error(errors.reason_password_failed) - elif user.is_expired: + + self.request.session['auth_backend'] = getattr(user, 'backend', settings.AUTH_BACKEND_MODEL) + + if user.is_expired: self.raise_credential_error(errors.reason_user_expired) elif not user.is_active: self.raise_credential_error(errors.reason_user_inactive)