Ask your Symfony questions! Pay money and get answers fast! (more info)

Best way to redirect to a previous page after JanRain RPX login? Symfony


Normally, when people login using sfGuardUser plugin code, the code gracefully redirects them to the referrer. For example, if a user wants to see some member directory, but needs to login to do so, they first get bumped to the login screen, then they get sent to the member directory. That is graceful.

Now I'm enabling login via JanRain RPX. I'm looking for ideas about how to imitate the above kind of login. As it stands now, if a user wanta to go to some member directory, and are asked to login, and choose, via JanRain RPX, to use their Yahoo login, then first they go off to JanRain/Yahoo, then they get redirected back to the page where we check the response from Yahoo, and then log them in if the data from Yahoo is valid. The fact that they were going to member directory gets lost in all of that. Right now we just redirect them to the user/home, after login, because we are not sure where else to send them.

Suggestions about better ways to do this?

Answers (1)


Kiril Angov answers:

Of course, just save the referrer url in the session. I use the plugin:

That should solve your problem :)

Lawrence Krubner comments:

Interesting. I was assuming I should store the previous page in the SESSION, but I could not figure out how to do that on every page. A filter does seem like a good idea.

Lawrence Krubner comments:

Installed. That plugin is awesome. Wish I'd known about it before.