Fix registration invite links losing token on external redirect#3215
Merged
Fix registration invite links losing token on external redirect#3215
Conversation
Copilot
AI
changed the title
[WIP] Fix registration links redirecting to login page externally
Fix registration invite links losing token on external redirect
Apr 3, 2026
gantoine
approved these changes
Apr 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes invite/registration flows where redirects to /login were dropping query parameters (notably /register?token=...) by ensuring the next parameter preserves the full path including the query string.
Changes:
- Preserve query params when building the
nextredirect value in the API 403 interceptor. - Preserve query params when building the
nextredirect value in the router auth navigation guard.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/services/api/index.ts | Uses pathname + search for next so query params (e.g., invite tokens) survive login redirects triggered by 403 handling. |
| frontend/src/plugins/router.ts | Uses to.fullPath for next so protected-route redirects keep the original query params through login. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Invite links (
/register?token=###) consistently redirect to/login?next=/registerwhen accessed externally, stripping the token and making registration impossible.Root cause: Two places constructed the
nextredirect value using only the URL path, dropping query params:services/api/index.ts): when an API call (e.g.fetchCurrentUser()) returns 403 due to CSRF/session issues through a reverse proxy, the redirect to login only capturedwindow.location.pathname, not the full URL with search paramsplugins/router.ts): unauthenticated route redirects usedto.pathinstead ofto.fullPathChanges:
frontend/src/services/api/index.ts: usepathname + searchas thenextvalue so query params are preservedfrontend/src/plugins/router.ts: replaceto.pathwithto.fullPathin the auth redirect guard so any query params on protected routes are also preserved through login