Skip to content

fix(auth): redirect unauthenticated users to login - #27

Open
kevjablonski wants to merge 2 commits into
mainfrom
fix/23-auth-unauthenticated-redirect
Open

kevjablonski wants to merge 2 commits into
mainfrom
fix/23-auth-unauthenticated-redirect

Conversation

@kevjablonski

Copy link
Copy Markdown

Summary

Fixes the global authentication middleware to correctly redirect unauthenticated users to the login page instead of rendering protected pages.

Changes

  • Updated the middleware to check useFetch errors and missing user data.
  • Updated /api/auth/currentUser to throw HTTP errors instead of returning them.
  • Preserved administration authorization checks, returning 403 for insufficient permissions.
  • Removed the unused middleware error handler referencing an undefined logger.

Testing

  • Verified expired or invalid sessions redirect to login.
  • Verified regular users cannot access administration pages.
  • Verified admins can access administration pages.

Related

Closes #23.

Signed-off-by: Kevin Jablonski <kevjablonski@gmail.com>
@github-actions

Copy link
Copy Markdown

Deployed d6e7688 to https://pr-27.tirtest.com

Signed-off-by: Kevin Jablonski <kevjablonski@gmail.com>
@github-actions

Copy link
Copy Markdown

Deployed 3c21c13 to https://pr-27.tirtest.com

This branch was successfully deployed

1 active deployment
review — 3c21c135 Deployed Oct 29, 2026 by kevjablonski via test #35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expired or missing session is not redirected to login on a direct page load

1 participant