Don't redirect away from Frontend after login
- Dominant language
- JavaScript
- Stars
- 226
- Forks
- 235
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 19
Description
Frontend uses the `next` query parameter to decide where to send the user after they log in. Frontend generally won't send the user outside Frontend, but it makes an exception for Enketo: it redirects the user away from Frontend if `next` starts with /-.
For example, this could happen today if a Data Collector bookmarks an Enketo form, then later reopens it. If the user isn't logged in (e.g., their session has expired), I'm pretty sure that Enketo will redirect the user to /login, setting `next` to the Enketo path.
However, as of getodk/central#883, this shouldn't happen anymore. Instead, before Enketo has a chance to redirect the user, nginx will redirect from /- to /f, which is a Frontend route. If the user isn't logged in, Frontend will set `next` to /f/... like it would for any Frontend route. Most importantly, the `next` query parameter won't get set to a /- path.
If there won't be a use case going forward in which the `next` query parameter is set to a /- path, I think we have the opportunity for some simplification. The `AccountLogin` component and the `navigateToNext()` method in particular would be simpler if they only ever redirected within Frontend. If Frontend won't need to redirect away from Frontend anymore, we could simplify things by removing that logic.
https://github.com/getodk/central-frontend/blob/f417bdd583ceea46cf3308fa24270477ca9f8024/src/components/account/login.vue#L162-L163
@sadiqkhoja, what do you think of this idea?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.