mirror of
https://github.com/wallabag/wallabag.git
synced 2024-09-27 05:50:02 +00:00
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Wallabag\UserBundle\EventListener;
|
|
|
|
use FOS\UserBundle\Event\FormEvent;
|
|
use FOS\UserBundle\FOSUserEvents;
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
|
|
/**
|
|
* Listener responsible to change the redirection at the end of the password resetting.
|
|
*
|
|
* @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;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function getSubscribedEvents()
|
|
{
|
|
return [
|
|
FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess',
|
|
];
|
|
}
|
|
|
|
public function onPasswordResettingSuccess(FormEvent $event)
|
|
{
|
|
$url = $this->router->generate('homepage');
|
|
|
|
$event->setResponse(new RedirectResponse($url));
|
|
}
|
|
}
|