fix: 修复需要设置 mfa 的 bug

pull/7354/head
ibuler 2021-12-09 14:48:49 +08:00 committed by Jiangjie.Bai
parent 1c3b574c46
commit ade3f3ae6c
1 changed files with 4 additions and 2 deletions

View File

@ -40,5 +40,7 @@ class TokenCreateApi(AuthMixin, CreateAPIView):
return Response(e.as_data(), status=400)
except errors.NeedMoreInfoError as e:
return Response(e.as_data(), status=200)
except errors.PasswordTooSimple as e:
return redirect(e.url)
except errors.MFAUnsetError:
return Response({'error': 'MFA unset, please set first'}, status=400)
except Exception as e:
return Response({"error": str(e)}, status=400)