From c7996544b4d0d50ec47ef8ddce65ebedd341f111 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Fri, 24 May 2024 18:43:37 +0530 Subject: [PATCH] fix: server error on email password disabled (#4584) --- apiserver/plane/authentication/adapter/error.py | 1 + .../plane/authentication/provider/credentials/email.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apiserver/plane/authentication/adapter/error.py b/apiserver/plane/authentication/adapter/error.py index 457a67f4f..7b12db945 100644 --- a/apiserver/plane/authentication/adapter/error.py +++ b/apiserver/plane/authentication/adapter/error.py @@ -17,6 +17,7 @@ AUTHENTICATION_ERROR_CODES = { "INVALID_EMAIL_SIGN_UP": 5045, "INVALID_EMAIL_MAGIC_SIGN_UP": 5050, "MAGIC_SIGN_UP_EMAIL_CODE_REQUIRED": 5055, + "EMAIL_PASSWORD_AUTHENTICATION_DISABLED": 5056, # Sign In "USER_DOES_NOT_EXIST": 5060, "AUTHENTICATION_FAILED_SIGN_IN": 5065, diff --git a/apiserver/plane/authentication/provider/credentials/email.py b/apiserver/plane/authentication/provider/credentials/email.py index 7e4e619d8..4c7764128 100644 --- a/apiserver/plane/authentication/provider/credentials/email.py +++ b/apiserver/plane/authentication/provider/credentials/email.py @@ -41,8 +41,10 @@ class EmailProvider(CredentialAdapter): if ENABLE_EMAIL_PASSWORD == "0": raise AuthenticationException( - error_code=AUTHENTICATION_ERROR_CODES["ENABLE_EMAIL_PASSWORD"], - error_message="ENABLE_EMAIL_PASSWORD", + error_code=AUTHENTICATION_ERROR_CODES[ + "EMAIL_PASSWORD_AUTHENTICATION_DISABLED" + ], + error_message="EMAIL_PASSWORD_AUTHENTICATION_DISABLED", ) def set_user_data(self):