Commit 4792371e by Julien Jorry

Fix issue with password request email

parent a7a40e4a
...@@ -3,6 +3,7 @@ namespace App\EventListener; ...@@ -3,6 +3,7 @@ namespace App\EventListener;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Event\FormEvent; use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\Event\GetResponseNullableUserEvent;
use FOS\UserBundle\Event\UserEvent; use FOS\UserBundle\Event\UserEvent;
use FOS\UserBundle\FOSUserEvents; use FOS\UserBundle\FOSUserEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
...@@ -36,10 +37,20 @@ class UserListener implements EventSubscriberInterface ...@@ -36,10 +37,20 @@ class UserListener implements EventSubscriberInterface
FOSUserEvents::REGISTRATION_SUCCESS => 'onRegistrationSuccess', FOSUserEvents::REGISTRATION_SUCCESS => 'onRegistrationSuccess',
FOSUserEvents::REGISTRATION_FAILURE => 'onRegistrationFailure', FOSUserEvents::REGISTRATION_FAILURE => 'onRegistrationFailure',
FOSUserEvents::RESETTING_RESET_SUCCESS => 'onResetSuccess', FOSUserEvents::RESETTING_RESET_SUCCESS => 'onResetSuccess',
FOSUserEvents::RESETTING_SEND_EMAIL_INITIALIZE => 'onResetInitialize',
FOSUserEvents::USER_CREATED => 'onUserCreated', FOSUserEvents::USER_CREATED => 'onUserCreated',
); );
} }
public function onResetInitialize(GetResponseNullableUserEvent $event)
{
$user = $event->getUser();
$user->setPasswordRequestedAt(null);
$user->setConfirmationToken(null);
$this->em->persist($user);
$this->em->flush();
}
public function onChangePasswordSuccess(FormEvent $event) public function onChangePasswordSuccess(FormEvent $event)
{ {
$url = $this->router->generate('index'); $url = $this->router->generate('index');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment