From 91dce82b38ca4ba756829c745f6f259718cabc03 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:01:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=89=E5=85=A8=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E4=BB=85=E5=B7=B2=E5=AD=98=E5=9C=A8=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=99=BB=E5=BD=95=EF=BC=8C=E4=BC=81=E4=B8=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E7=AD=89=E6=89=AB=E6=8F=8F=E7=99=BB=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=94=A8=E6=88=B7=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=EF=BC=8C=E8=BF=98=E6=98=AF=E4=BC=9A=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E3=80=82=20(#11651)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/authentication/views/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/authentication/views/base.py b/apps/authentication/views/base.py index 7969502c0..c118680f0 100644 --- a/apps/authentication/views/base.py +++ b/apps/authentication/views/base.py @@ -12,6 +12,7 @@ from authentication.mixins import AuthMixin from common.utils import get_logger 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 logger = get_logger(__file__) @@ -49,6 +50,11 @@ class BaseLoginCallbackView(AuthMixin, FlashMessageMixin, View): user, create = User.objects.get_or_create( username=user_attr['username'], defaults=user_attr ) + + if not check_only_allow_exist_user_auth(create): + user.delete() + return user, (self.msg_client_err, self.request.error_message) + setattr(user, f'{self.user_type}_id', user_id) if create: setattr(user, 'source', self.user_type)