0
votes

I am trying to redirect the user to an activation page from an external source.

Essentially they click our CTA and it requests a service, then it works as follows:

  1. Unauthenticated User Clicks CTA
  2. (Not Logged In) User gets blocked by the firewall, redirects to /login
  3. If the user logs in they get redirected to the correct route that was requested and everything works as expected.

Now my issue lies in when the unauthenticated user does not login, and rather creates an account, FOSUserBundle automatically unsets the sf_redirect cookie which in turn breaks the functionality that exists.

I would like to know if there is a way to persist the sf_redirect request onto the registerAction and once the user completes registration redirect to the correct place.

I know one way to do this would be to hook into the loginController for the FOS User Bundle and persist the requested route into another cookie parameter and lookup weather or not that parameter is set and redirect ( or not ) I was just wondering if there was a cleaner / better way of doing this ?.

1

1 Answers

0
votes

I Managed to resolve this by hooking into the the events and setting a cookie, I then checked that cookie once the login || Register complete event was fired and I redirect the user to the specified URL if it is in an array of URLS I permit through the firewall.