From 35f3716cb5211b79ced3ed285a38111da181a1d8 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Mon, 20 May 2024 12:56:29 +0530 Subject: [PATCH] fix: magic code 500 error on wrong code or expired code (#4521) --- .../plane/authentication/provider/credentials/magic_code.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apiserver/plane/authentication/provider/credentials/magic_code.py b/apiserver/plane/authentication/provider/credentials/magic_code.py index d53ce754a..21309ea9c 100644 --- a/apiserver/plane/authentication/provider/credentials/magic_code.py +++ b/apiserver/plane/authentication/provider/credentials/magic_code.py @@ -88,7 +88,7 @@ class MagicCodeProvider(CredentialAdapter): if data["current_attempt"] > 2: email = str(self.key).replace("magic_", "", 1) - if User.objects.exists(email=email): + if User.objects.filter(email=email).exists(): raise AuthenticationException( error_code=AUTHENTICATION_ERROR_CODES[ "EMAIL_CODE_ATTEMPT_EXHAUSTED_SIGN_IN" @@ -144,7 +144,7 @@ class MagicCodeProvider(CredentialAdapter): return else: email = str(self.key).replace("magic_", "", 1) - if User.objects.exists(email=email): + if User.objects.filter(email=email).exists(): raise AuthenticationException( error_code=AUTHENTICATION_ERROR_CODES[ "INVALID_MAGIC_CODE_SIGN_IN" @@ -162,7 +162,7 @@ class MagicCodeProvider(CredentialAdapter): ) else: email = str(self.key).replace("magic_", "", 1) - if User.objects.exists(email=email): + if User.objects.filter(email=email).exists(): raise AuthenticationException( error_code=AUTHENTICATION_ERROR_CODES[ "EXPIRED_MAGIC_CODE_SIGN_IN"