Closed bartoszrychlicki closed 11 years ago
if you have "confirmation.enabled: true", you can put a hook here
if ($return instanceof RedirectResponse) {
return $return;
}
and send an email before the user confirm the registration.
instead if you have "confirmation.enabled: false" you can listen to "security.manual_login" event.
Anyway I will add two events (pre and post) for registration, but not immediately ;-)
Ok, but how to get user object there?
as in every controller that extends Symfony\Bundle\FrameworkBundle\Controller\Controller that implements ContainerAwareInterface, with getUser() that is a wrapper for $this->container->get('security.context')->getToken()->getUser();
or
injectiing the Container to your own class (for example a listener)
or
if you are listening "security.manual_login" you can use getUser() method of ManualLoginEvent
Thanks for replay, but user is not logged right after registration, so I can't use security context, container will not do anything also.
Is there a way to get registered user from registration handler?
yes you are right, so you can get the user from the form.
Any tip on how to do it perhaps? :-)
As controllers look bit diffrent than in FOSUserBundle, how can I put some custom logic after registration process? For example I want to send a e-mail to registered user. Where should I put this and how can I fetch registered user entity before he's logged in.