diff --git a/apps/authentication/mixins.py b/apps/authentication/mixins.py index 6bd10c4c4..003027b0d 100644 --- a/apps/authentication/mixins.py +++ b/apps/authentication/mixins.py @@ -6,7 +6,7 @@ from django.conf import settings from common.utils import get_object_or_none, get_request_ip, get_logger from users.models import User from users.utils import ( - is_block_login, clean_failed_count, increase_login_failed_count + is_block_login, clean_failed_count, increase_login_failed_count, ) from . import errors from .utils import check_user_valid diff --git a/apps/authentication/views/login.py b/apps/authentication/views/login.py index 85244e85d..de3e0dd31 100644 --- a/apps/authentication/views/login.py +++ b/apps/authentication/views/login.py @@ -20,7 +20,7 @@ from django.urls import reverse_lazy from common.utils import get_request_ip, get_object_or_none from users.utils import ( - redirect_user_first_login_or_index + redirect_user_first_login_or_index, set_tmp_user_to_cache ) from .. import forms, mixins, errors @@ -128,13 +128,14 @@ class UserLoginGuardView(mixins.AuthMixin, RedirectView): except errors.LoginConfirmBaseError: return self.format_redirect_url(self.login_confirm_url) else: - auth_login(self.request, user) - self.send_auth_signal(success=True, user=user) - self.clear_auth_mark() # 启用但是没有设置otp, 排除radius if user.mfa_enabled_but_not_set(): # 1,2,mfa_setting & F + set_tmp_user_to_cache(self.request, user) return reverse('users:user-otp-enable-authentication') + auth_login(self.request, user) + self.send_auth_signal(success=True, user=user) + self.clear_auth_mark() url = redirect_user_first_login_or_index( self.request, self.redirect_field_name ) diff --git a/apps/templates/_without_nav_base.html b/apps/templates/_without_nav_base.html index f20324b5a..98bcb6189 100644 --- a/apps/templates/_without_nav_base.html +++ b/apps/templates/_without_nav_base.html @@ -10,6 +10,7 @@ {# #} + diff --git a/apps/users/api/user.py b/apps/users/api/user.py index f41ce152d..98dcbd91c 100644 --- a/apps/users/api/user.py +++ b/apps/users/api/user.py @@ -179,5 +179,4 @@ class UserResetOTPApi(UserQuerysetMixin, generics.RetrieveAPIView): if user.mfa_enabled: user.reset_mfa() user.save() - logout(request) return Response({"msg": "success"}) diff --git a/apps/users/templates/users/user_otp_enable_bind.html b/apps/users/templates/users/user_otp_enable_bind.html index fbb361595..7aaa25236 100644 --- a/apps/users/templates/users/user_otp_enable_bind.html +++ b/apps/users/templates/users/user_otp_enable_bind.html @@ -15,8 +15,7 @@
-