diff --git a/apps/authentication/api/login_confirm.py b/apps/authentication/api/login_confirm.py index 71613348c..5bddda4e3 100644 --- a/apps/authentication/api/login_confirm.py +++ b/apps/authentication/api/login_confirm.py @@ -6,6 +6,8 @@ from rest_framework.permissions import AllowAny from common.utils import get_logger from .. import errors, mixins +from django.contrib.auth import logout as auth_logout + __all__ = ['TicketStatusApi'] logger = get_logger(__name__) @@ -19,8 +21,11 @@ class TicketStatusApi(mixins.AuthMixin, APIView): self.check_user_login_confirm() self.request.session['auth_third_party_done'] = 1 return Response({"msg": "ok"}) + except errors.LoginConfirmOtherError as e: + self.send_auth_signal(success=False, user=request.user, username=request.user.name, reason=e.as_data().get('msg')) + auth_logout(request) + return Response(e.as_data(), status=200) except errors.NeedMoreInfoError as e: - self.send_auth_signal(success=False, reason=e.as_data().get('msg')) return Response(e.as_data(), status=200) def delete(self, request, *args, **kwargs):