Browse Source

fix: 【Lark】绑定时,一些报错信息优化 (#13004)

Co-authored-by: feng <1304903146@qq.com>
pull/13006/head
fit2bot 7 months ago committed by GitHub
parent
commit
f3d19ad9f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      apps/authentication/views/base.py

14
apps/authentication/views/base.py

@ -1,8 +1,8 @@
from functools import lru_cache
from django.conf import settings
from django.db.utils import IntegrityError
from django.contrib.auth import logout as auth_logout
from django.db.utils import IntegrityError
from django.utils.module_loading import import_string
from django.utils.translation import gettext_lazy as _
from django.views import View
@ -12,8 +12,8 @@ from authentication import errors
from authentication.mixins import AuthMixin
from authentication.notifications import OAuthBindMessage
from common.utils import get_logger
from common.utils.django import reverse, get_object_or_none
from common.utils.common import get_request_ip
from common.utils.django import reverse, get_object_or_none
from users.models import User
from users.signal_handlers import check_only_allow_exist_user_auth
from .mixins import FlashMessageMixin
@ -83,7 +83,15 @@ class BaseLoginCallbackView(AuthMixin, FlashMessageMixin, IMClientMixin, View):
if not self.verify_state():
return self.get_verify_state_failed_response(redirect_url)
user_id, other_info = self.client.get_user_id_by_code(code)
try:
user_id, other_info = self.client.get_user_id_by_code(code)
except Exception:
response = self.get_failed_response(
login_url, title=self.msg_client_err,
msg=self.msg_not_found_user_from_client_err
)
return response
if not user_id:
# 正常流程不会出这个错误,hack 行为
err = self.msg_not_found_user_from_client_err

Loading…
Cancel
Save