perf: 修复首页登录mfa错误提示

This commit is contained in:
ibuler
2021-11-15 18:36:22 +08:00
committed by 老广
parent 22c9dfc0f2
commit cc2d47e6dc
11 changed files with 113 additions and 91 deletions

View File

@@ -44,7 +44,7 @@ class MFASendCodeApi(AuthMixin, CreateAPIView):
else:
user = get_object_or_404(User, username=username)
mfa_backend = user.get_mfa_backend_by_type(mfa_type)
mfa_backend = user.get_active_mfa_backend_by_type(mfa_type)
if not mfa_backend or not mfa_backend.challenge_required:
raise ValidationError('MFA type not support: {} {}'.format(mfa_type, mfa_backend))
mfa_backend.send_challenge()