3 namespace Wallabag\UserBundle\EventListener
;
5 use FOS\UserBundle\FOSUserEvents
;
6 use FOS\UserBundle\Event\FormEvent
;
7 use Symfony\Component\EventDispatcher\EventSubscriberInterface
;
8 use Symfony\Component\HttpFoundation\RedirectResponse
;
9 use Symfony\Component\Routing\Generator\UrlGeneratorInterface
;
12 * Listener responsible to change the redirection at the end of the password resetting
14 * @see http://symfony.com/doc/current/bundles/FOSUserBundle/controller_events.html
16 class PasswordResettingListener
implements EventSubscriberInterface
20 public function __construct(UrlGeneratorInterface
$router)
22 $this->router
= $router;
28 public static function getSubscribedEvents()
31 FOSUserEvents
::RESETTING_RESET_SUCCESS
=> 'onPasswordResettingSuccess',
35 public function onPasswordResettingSuccess(FormEvent
$event)
37 $url = $this->router
->generate('homepage');
39 $event->setResponse(new RedirectResponse($url));