Skip to content

Commit

Permalink
Merge pull request #1705 from bcgov/fix/hamed-unauthorized-page-setup…
Browse files Browse the repository at this point in the history
…-1616

Fix: Resolve 401 Toast Pop-Up for Inactive IDIR Accounts - 1616
  • Loading branch information
hamed-valiollahi authored Jan 16, 2025
2 parents 7ffaa75 + a3123e1 commit 549996a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/lcfs/services/keycloak/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async def authenticate(self, request):
await self.create_login_history(
user_token, False, error_text
)
raise HTTPException(status_code=401, detail=error_text)
raise HTTPException(status_code=403, detail=error_text)
else:
# Already found by keycloak_user_id => return
return AuthCredentials(["authenticated"]), user
Expand Down Expand Up @@ -204,7 +204,7 @@ async def authenticate(self, request):
if not user.is_active:
error_text = "The account is currently inactive."
await self.create_login_history(user_token, False, error_text)
raise HTTPException(status_code=401, detail=error_text)
raise HTTPException(status_code=403, detail=error_text)
else:
error_text = "preferred_username or email is required in JWT payload."
raise HTTPException(status_code=401, detail=error_text)
Expand Down

0 comments on commit 549996a

Please sign in to comment.