Skip to content

Redirect to original page after creating an account? #300

Answered by janko
moneill asked this question in Q&A
Discussion options

You must be logged in to vote

To prevent session fixation attacks, the session will get reset when the user is autologged in after account creation, which includes the login redirect session key. The login feature explicitly caches the value in an instance variable so that after login it can redirect to that page (as login will clear the session). However, the autologin after account creation doesn't reuse this code.

You should be able to do something like:

before_create_account { @saved_create_account_redirect = remove_session_value(login_redirect_session_key) }
create_account_redirect { @saved_create_account_redirect || super() }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@moneill
Comment options

Answer selected by moneill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants