2016-01-21 15:39:13 +00:00
|
|
|
<?php
|
|
|
|
|
2023-12-30 22:54:25 +00:00
|
|
|
namespace Wallabag\CoreBundle\Event\Listener;
|
2016-01-21 15:39:13 +00:00
|
|
|
|
|
|
|
use FOS\UserBundle\Event\FormEvent;
|
2017-07-01 07:52:38 +00:00
|
|
|
use FOS\UserBundle\FOSUserEvents;
|
2016-01-21 15:39:13 +00:00
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
|
|
|
|
|
|
/**
|
2016-01-22 07:01:32 +00:00
|
|
|
* Listener responsible to change the redirection at the end of the password resetting.
|
2016-01-21 15:39:13 +00:00
|
|
|
*
|
|
|
|
* @see http://symfony.com/doc/current/bundles/FOSUserBundle/controller_events.html
|
|
|
|
*/
|
|
|
|
class PasswordResettingListener implements EventSubscriberInterface
|
|
|
|
{
|
|
|
|
private $router;
|
|
|
|
|
|
|
|
public function __construct(UrlGeneratorInterface $router)
|
|
|
|
{
|
|
|
|
$this->router = $router;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getSubscribedEvents()
|
|
|
|
{
|
2016-04-12 09:36:01 +00:00
|
|
|
return [
|
2016-01-21 15:39:13 +00:00
|
|
|
FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess',
|
2016-04-12 09:36:01 +00:00
|
|
|
];
|
2016-01-21 15:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onPasswordResettingSuccess(FormEvent $event)
|
|
|
|
{
|
|
|
|
$url = $this->router->generate('homepage');
|
|
|
|
|
|
|
|
$event->setResponse(new RedirectResponse($url));
|
|
|
|
}
|
|
|
|
}
|