Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR restricts guest mode access by removing the dashboard from the list of guest-allowed routes and ensuring guest users are redirected to the login page when accessing protected paths.
- Removed
/dashboardfromGUEST_ALLOWED_ROUTESarray - Added explicit redirect to login for guest users accessing non-allowed routes
- Refactored authentication logic by removing unnecessary conditional wrapper
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -43,32 +47,30 @@ export async function middleware(request: NextRequest) { | |||
| } | |||
|
|
|||
| // Only create Supabase client and check session if NOT in guest mode | |||
There was a problem hiding this comment.
The comment at line 49 is now inaccurate. After the refactoring, the Supabase client is created regardless of guest mode status. Since guest mode users that reach this point have already been redirected (line 40), the comment should be updated to reflect that this code only executes for non-guest users due to the early return, or the comment should be removed as it's now misleading.
| // Only create Supabase client and check session if NOT in guest mode |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (isGuestAllowedRoute) { | ||
| return response | ||
| } | ||
|
|
||
| return NextResponse.redirect(new URL('/auth/login', request.url)) |
There was a problem hiding this comment.
Guest mode now loops back to login
Removing /dashboard from the guest-allowed list means requests with the guestMode cookie now hit this branch and are redirected to /auth/login. The GuestModeButton still sets that cookie and routes guests to /dashboard, so “Continue as Guest” immediately bounces back to the login page and the guest dashboard experience is unreachable. Consider keeping /dashboard guest-accessible or update the guest entry point/target so the guest flow still lands on an allowed page.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task