From 09d51fd5be0eb63d28db3627dcb1aefdf43f7336 Mon Sep 17 00:00:00 2001 From: xinwen Date: Mon, 13 Sep 2021 15:57:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20OTP=5FIN=5FRADIUS=20=E4=B8=8E=20mfa=20?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/mixins.py | 4 ++++ apps/authentication/signals_handlers.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/authentication/mixins.py b/apps/authentication/mixins.py index 3a2f9c09b..46995158d 100644 --- a/apps/authentication/mixins.py +++ b/apps/authentication/mixins.py @@ -346,6 +346,10 @@ class AuthMixin(PasswordEncryptionViewMixin): def check_user_mfa_if_need(self, user): if self.request.session.get('auth_mfa'): return + + if settings.OTP_IN_RADIUS: + return + if not user.mfa_enabled: return unset, url = user.mfa_enabled_but_not_set() diff --git a/apps/authentication/signals_handlers.py b/apps/authentication/signals_handlers.py index c6c1db680..87b177ff5 100644 --- a/apps/authentication/signals_handlers.py +++ b/apps/authentication/signals_handlers.py @@ -14,7 +14,8 @@ from .signals import post_auth_success, post_auth_failed @receiver(user_logged_in) def on_user_auth_login_success(sender, user, request, **kwargs): # 开启了 MFA,且没有校验过 - if user.mfa_enabled and not request.session.get('auth_mfa'): + + if user.mfa_enabled and not settings.OTP_IN_RADIUS and not request.session.get('auth_mfa'): request.session['auth_mfa_required'] = 1 if settings.USER_LOGIN_SINGLE_MACHINE_ENABLED: