Skip to content

Commit

Permalink
fix: admin login when the user is not present (#6399)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohashescobar authored Jan 16, 2025
1 parent fd7eedc commit 95f43a7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions apiserver/plane/license/api/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,24 +290,24 @@ 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),
"?" + urlencode(exc.get_error_dict()),
)
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),
Expand Down

0 comments on commit 95f43a7

Please sign in to comment.