Skip to content

Redirects after verify account from email #249

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

You must be logged in to vote

In the 3 cases that you mentioned, all of them call the #login method, which handles session[login_redirect_session_key]. When the account is verified, the autologin that's performed doesn't call the #login method, but updates the session directly, clearing session[login_redirect_session_key] before verify_account_redirect is reached.

You could try saving it in an instance variable instead:

before_verify_account_route do
  if request.get?
    session[:verify_account_redirect] = param('redirect_to_path')
  elsif request.post?
    @verify_account_redirect = session[:verify_account_redirect]
  end
end

verify_account_redirect { @verify_account_redirect || super() }

Replies: 1 comment 1 reply

Comment options

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

Answer selected by Halvanhelv
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