Closed scosman closed 1 month ago
[!CAUTION]
Review failed
The pull request is closed.
The changes involve modifications to user authentication and session management across multiple files. Key alterations include the introduction of a new helper function for session retrieval, refactoring of existing authentication logic, and adjustments to redirection behavior based on user session states. The overall structure and flow of the application are simplified, enhancing maintainability while addressing user access to specific routes.
Files | Change Summary |
---|---|
.vscode/settings.json |
Added "editor.tabSize": 2 to standardize code formatting; existing property "eslint.validate" updated with a trailing comma. |
src/hooks.server.ts |
Removed redirection logic in authGuard function, simplifying user authentication handling. |
src/lib/load_helpers.ts |
Introduced load_helper function for managing user session retrieval in Supabase, improving session management across environments. |
src/routes/(admin)/account/+layout.ts |
Refactored session and user authentication logic into load_helper , enhancing code structure and maintainability. |
src/routes/(marketing)/login/+layout.server.ts |
Removed redirection for logged-in users in load function, simplifying behavior and allowing users to remain on the login page. |
src/routes/(marketing)/login/+layout.ts |
Added session check and redirect logic in load function to prevent logged-in users from accessing the login page, enhancing user experience. |
sequenceDiagram
participant User
participant Auth
participant Helper
participant Session
User->>Auth: Request access to /account
Auth->>Session: Check session status
Session-->>Auth: Return session data
Auth->>Helper: Call load_helper(session)
Helper-->>Auth: Return session and user data
Auth-->>User: Grant access to /account
🐰 In a world where sessions play,
With helpers bright, they guide the way.
No more redirects, just simple flows,
A rabbit hops where the user goes!
With every change, the code does cheer,
For smoother paths, we hold so dear! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Latest commit: |
83c8189
|
Status: | ✅ Deploy successful! |
Preview URL: | https://a23863b0.saasstarter.pages.dev |
Branch Preview URL: | https://fix-redirect-loop.saasstarter.pages.dev |
We were inconsistent for how we redirected login to account and vice versa. A expired session could enter redirect loop.
Also dont redirect from authHandler. I don't want to leave any page to account when logged in, just /login/*
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores