After clicking confirmation e-mail link user is automatically logged in but custom Authentication handler is not called
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?
The same situation occurs after successfully resetting password.
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.
since #867 the process dispatches the FOS\UserBundle\FOSUserEvents::SECURITY_IMPLICIT_LOGIN event
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).
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.
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);