Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: magic code 500 error on wrong code or expired code (#4521)

Nikhil35f3716cb521
diff --git a/apiserver/plane/authentication/provider/credentials/magic_code.py b/apiserver/plane/authentication/provider/credentials/magic_code.py
index d53ce754a4..21309ea9c4 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"