keruilin
keruilin

Reputation: 17532

Return user to original page after logging in (rails session mgmt)

I'm looking for some general guidance as to how to return a user back to the original page they were viewing after trying to log-in.

The way I have the site setup now is that if a user visits the Store page, for example, and then clicks the login button in the upper right, the user is returned to the default landing page.

Any help would be greatly appreciated!

Upvotes: 1

Views: 174

Answers (1)

Jakub Hampl
Jakub Hampl

Reputation: 40553

There are two ways how to do it:

  • either pass the current url as a param to the login link
  • or check the request object for the referrer and if it's from your own site redirect back

Upvotes: 1

Related Questions