From 95f43a7bb663dd8105dac0896deb648ff7f0cdbf Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Thu, 16 Jan 2025 19:59:04 +0530 Subject: [PATCH] fix: admin login when the user is not present (#6399) --- 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 10c6df5c36..97f0e446e3 100644 --- a/apiserver/plane/license/api/views/admin.py +++ b/apiserver/plane/license/api/views/admin.py @@ -290,11 +290,12 @@ class InstanceAdminSignInEndpoint(View): # 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 @@ class InstanceAdminSignInEndpoint(View): ) 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),