From 3fbef7e3ffdf2235aa5b4873a82d24d6c2619dfa Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Wed, 15 Jan 2025 12:55:44 +0530 Subject: [PATCH] fix: admin login when the user is not present --- apiserver/plane/license/api/views/admin.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apiserver/plane/license/api/views/admin.py b/apiserver/plane/license/api/views/admin.py index 10c6df5c36f..97f0e446e36 100644 --- a/apiserver/plane/license/api/views/admin.py +++ b/apiserver/plane/license/api/views/admin.py @@ -290,11 +290,12 @@ def post(self, request): # Fetch the user user = User.objects.filter(email=email).first() - # is_active - if not user.is_active: + # Error out if the user is not present + if not user: exc = AuthenticationException( - error_code=AUTHENTICATION_ERROR_CODES["ADMIN_USER_DEACTIVATED"], - error_message="ADMIN_USER_DEACTIVATED", + error_code=AUTHENTICATION_ERROR_CODES["ADMIN_USER_DOES_NOT_EXIST"], + error_message="ADMIN_USER_DOES_NOT_EXIST", + payload={"email": email}, ) url = urljoin( base_host(request=request, is_admin=True), @@ -302,12 +303,11 @@ def post(self, request): ) return HttpResponseRedirect(url) - # Error out if the user is not present - if not user: + # is_active + if not user.is_active: exc = AuthenticationException( - error_code=AUTHENTICATION_ERROR_CODES["ADMIN_USER_DOES_NOT_EXIST"], - error_message="ADMIN_USER_DOES_NOT_EXIST", - payload={"email": email}, + error_code=AUTHENTICATION_ERROR_CODES["ADMIN_USER_DEACTIVATED"], + error_message="ADMIN_USER_DEACTIVATED", ) url = urljoin( base_host(request=request, is_admin=True),