Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

239 after login redirect to the original page #1131

Conversation

Taeir
Copy link
Contributor

@Taeir Taeir commented Jul 20, 2023

The way this works is by always storing the last url the user visited, expect if that was any URL we want to ignore (AJAX, file/image, edits, sign-in pages, ...). If a user then presses sign in and signs in, they are redirected back to the last stored location. (It makes use of the fact that Rails uses session cookies also for non-signed-in users to identify them across different requests.)

Normal devise sign ins already make use of the location, thus I only had to edit the redirects for our customized sign-in endpoints (mobile sign in and 2FA).

When doing a 2FA sign in (email based), you first sign in with email and password, then it sends you back to the page you were looking at before going to the sign in, while asking you to check your mail. The link in the email will again send you to that same page when used.

Fixes #239

It does not seem there is a good way to split off these methods (only
one usage site, not worth to extract into separate functionality).
@Taeir Taeir requested a review from a team July 20, 2023 09:52
@ArtOfCode- ArtOfCode- merged commit d26062b into codidact:develop Aug 1, 2023
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

after login, redirect to the original page
3 participants