Skip to content

After clicking confirmation e-mail link user is automatically logged in but custom Authentication handler is not called #871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
WojciechJasinski opened this issue Nov 16, 2012 · 6 comments

Comments

@WojciechJasinski
Copy link

I have crated custom authentication handler that creates some extra sessions on authentication success. While using FOSUserBundle with email confirmation enabled this handler is not called when new user clicks confirmation link.
My handler is configured in form_login:success_handler (security.yml).
How can I add this to FOSUserBundle confirmation process as well?

@WojciechJasinski
Copy link
Author

The same situation occurs after successfully resetting password.

@mvrhov
Copy link

mvrhov commented Nov 26, 2012

AFAIK the login after reset/confirmation is done by creating a security context object and storing it into the session. Because this is done outside the Symfonys2 normal authentication workflow none of those events get triggered.

@stof
Copy link
Member

stof commented Dec 27, 2012

since #867 the process dispatches the FOS\UserBundle\FOSUserEvents::SECURITY_IMPLICIT_LOGIN event

@OwlyCode
Copy link

I encounter the same problem with registration. I have a handler adding cookies for doing a kind of SSO. How can I add cookies with the listener of the implicit login ? Modifying the response object in the middle of an event listener does not sounds right to me (And I didn't find how to do it).

@bobemoe
Copy link

bobemoe commented Mar 14, 2013

I am also wanting to modify the Response after login, and this is working ok with an AuthenticationHandler, but the handler is not called after reset/confirmation. I am listening to SECURITY_IMPLICIT_LOGIN but am unable to modify the Response from within the listener. How can I trigger the handler or modify the response? I see some events have $event->setResponse() but the events here do not.

@jur3
Copy link

jur3 commented Aug 29, 2014

You can override confirmAction of FOSUserBundle and add this code to the end.

$token = $this->container->get('security.context')->getToken();
$response = $this->container->get('authentication_handler')->onAuthenticationSuccess($request, $token);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants