perf: 优化频繁发送短信,将后端的频繁发送警告提示到页面上来提醒用户

This commit is contained in:
jiangweidong
2024-04-19 17:11:25 +08:00
committed by Bryan
parent ad0bc82539
commit ef7329a721
3 changed files with 15 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.serializers import ValidationError
from common.exceptions import UnexpectError
from common.exceptions import JMSException, UnexpectError
from common.utils import get_logger
from users.models.user import User
from .. import errors
@@ -61,6 +61,8 @@ class MFASendCodeApi(AuthMixin, CreateAPIView):
try:
mfa_backend.send_challenge()
except JMSException:
raise
except Exception as e:
raise UnexpectError(str(e))