fix(web): send unsigned-in account visits to login - #722
Conversation
Visiting /account or /admin without a session now redirects to /login with callbackURL set to the original path, instead of a dead-end "You're not signed in" page.
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (2)
🚫 Excluded labels (none allowed) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-web | 1dbf9f8 | Commit Preview URL Branch Preview URL |
Aug 20 2026, 10:40 PM |
In plain terms
Opening an account or admin URL while signed out used to dump you on a dead-end “You’re not signed in” page. Those visits now go to the login form, and after GitHub or a magic link you land back on the page you asked for.
What it does / what it is not
/account/*and/admin/*requests 302 to/login?callbackURL=<original path>.callbackURL; it now also ignores/loginitself so the bounce cannot loop.How to try it
In a private window, open
https://uploads.sh/account/workspacesor any workspace screenshots URL. You should get the Sign in form, not the error callout. After signing in you should return to that same path.Technical notes
Astro layouts cannot return
Astro.redirectonce HTML streaming has started, so the 302 lives insrc/middleware.ts.callbackURLis a same-origin path only.Test plan
/loginrejected as a return pathlocation.replacewith callbackURL; role mismatch still denied/account/…?path=→ 302Location: /login?callbackURL=…/account/workspaces/acme/screenshotsand/admin/usersland on Sign in with the matching callback/docsstill 200