Skip to content

fix(auth): preserve next on login + default home to realtime map#266

Merged
Cheewye merged 1 commit intomainfrom
fix/auth-next-and-home
Feb 14, 2026
Merged

fix(auth): preserve next on login + default home to realtime map#266
Cheewye merged 1 commit intomainfrom
fix/auth-next-and-home

Conversation

@Cheewye
Copy link
Owner

@Cheewye Cheewye commented Feb 14, 2026

What changed

  • Home route (/) now redirects to /map?start=realtime (removes forced mode=preparacion).
  • Protected routes now redirect unauthenticated users to /login?next=<current path + search + hash>.
  • After successful login, the app navigates back to next (only if it starts with /), otherwise falls back to /map?start=realtime (prevents open redirect).

Why

  • Avoid surprising default state (mode=preparacion) as a global entry URL.
  • Preserve user intent when auth is required (standard next pattern).
  • Improve security by blocking external/open redirects.

Files changed (frontend only)

  • frontend/src/App.tsx
  • frontend/src/components/auth/ProtectedRoute.tsx
  • frontend/src/pages/LoginPage.tsx

Verification

  • npm -C frontend run build ✅ PASS
  • Manual:
    • Visiting / redirects to /map?start=realtime
    • Visiting /map?start=realtime while logged out redirects to /login?next=/map?start=realtime
    • After login, returns to next (or safe fallback)

Co-authored-by: Cursor <cursoragent@cursor.com>
@Cheewye Cheewye merged commit a6c1de4 into main Feb 14, 2026
11 checks passed
@Cheewye Cheewye deleted the fix/auth-next-and-home branch February 14, 2026 09:17
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.

1 participant