aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-01-22 09:36:50 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-01-22 09:36:50 +0100
commit6c32aaae95caf6fcd6740fa1a78f8af31bb6370f (patch)
tree87a1f573e7b405f34588a91f87b9196810cdaa7a /src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php
parent9aa66d6244935fe86a5598fbdbe518cf6204af2e (diff)
parent23afdf3a70a5035cb58b76138a8627701ba55273 (diff)
downloadwallabag-6c32aaae95caf6fcd6740fa1a78f8af31bb6370f.tar.gz
wallabag-6c32aaae95caf6fcd6740fa1a78f8af31bb6370f.tar.zst
wallabag-6c32aaae95caf6fcd6740fa1a78f8af31bb6370f.zip
Merge pull request #1614 from wallabag/v2-few-fixes
Few fixes
Diffstat (limited to 'src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php')
-rw-r--r--src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php b/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php
new file mode 100644
index 00000000..128e85a4
--- /dev/null
+++ b/src/Wallabag/UserBundle/EventListener/PasswordResettingListener.php
@@ -0,0 +1,41 @@
1<?php
2
3namespace Wallabag\UserBundle\EventListener;
4
5use FOS\UserBundle\FOSUserEvents;
6use FOS\UserBundle\Event\FormEvent;
7use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8use Symfony\Component\HttpFoundation\RedirectResponse;
9use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
10
11/**
12 * Listener responsible to change the redirection at the end of the password resetting.
13 *
14 * @see http://symfony.com/doc/current/bundles/FOSUserBundle/controller_events.html
15 */
16class PasswordResettingListener implements EventSubscriberInterface
17{
18 private $router;
19
20 public function __construct(UrlGeneratorInterface $router)
21 {
22 $this->router = $router;
23 }
24
25 /**
26 * {@inheritdoc}
27 */
28 public static function getSubscribedEvents()
29 {
30 return array(
31 FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess',
32 );
33 }
34
35 public function onPasswordResettingSuccess(FormEvent $event)
36 {
37 $url = $this->router->generate('homepage');
38
39 $event->setResponse(new RedirectResponse($url));
40 }
41}