Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check valid session in middleware #1133

Merged
merged 5 commits into from May 22, 2024

Conversation

joonatank
Copy link
Contributor

🛠️ Changelog

  • Fix: redirect to login middleware to check for valid session not just the existence of the session cookie.
  • Remove unnecessary isAuthenticated checks (the middleware handles that), that caused an error message to be shown if the session was invalid.
  • Refactor: load applications list on SSR on first load and remove loading spinner.

🧪 Test plan

  • Manual testing: applications listing page.
  • Manual testing: if not logged in protected routes (e.g. my reservations etc.) should redirect to login page.

🎫 Tickets

  • TILA-####

@joonatank joonatank force-pushed the fix-check-valid-session-in-middleware branch 2 times, most recently from 04c6a8d to 8f1c49f Compare April 24, 2024 12:29
Copy link
Contributor

@vincit-matu vincit-matu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joonatank joonatank force-pushed the fix-check-valid-session-in-middleware branch from 8f1c49f to 3764499 Compare May 6, 2024 07:43
@joonatank joonatank force-pushed the fix-check-valid-session-in-middleware branch 2 times, most recently from b1139a9 to 9713fe7 Compare May 15, 2024 06:48
Instead of just checking for existence of session cookie, do a query to
the backend to confirm the session is still valid.

Redirect to login as before if the session is not valid.
Middleware will redirect the user if they are not logged in so the hooks
were just adding a flash of unauthorized content on first page load.
@joonatank joonatank force-pushed the fix-check-valid-session-in-middleware branch from 9713fe7 to 825f9f2 Compare May 22, 2024 10:06
@joonatank joonatank merged commit bce1796 into main May 22, 2024
6 checks passed
@joonatank joonatank deleted the fix-check-valid-session-in-middleware branch May 22, 2024 10:13
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.

None yet

2 participants