From 2a671ea7dba0d1c2612209f4910ee409442606d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ma=C5=82olepszy?= Date: Sun, 5 Aug 2018 01:57:18 +0200 Subject: [PATCH 1/2] Dispatches FOSUserEvents::RESETTING_SEND_EMAIL_FAILURE event whenever resetting email is not send due to non-existing username or expired password request. --- Controller/ResettingController.php | 7 +++++++ FOSUserEvents.php | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Controller/ResettingController.php b/Controller/ResettingController.php index cce1e0a45a..3ff2a83e0d 100644 --- a/Controller/ResettingController.php +++ b/Controller/ResettingController.php @@ -117,6 +117,13 @@ public function sendEmailAction(Request $request) $event = new GetResponseUserEvent($user, $request); $this->eventDispatcher->dispatch(FOSUserEvents::RESETTING_SEND_EMAIL_COMPLETED, $event); + if (null !== $event->getResponse()) { + return $event->getResponse(); + } + } else { + $event = new GetResponseNullableUserEvent($user, $request); + $this->eventDispatcher->dispatch(FOSUserEvents::RESETTING_SEND_EMAIL_FAILURE, $event); + if (null !== $event->getResponse()) { return $event->getResponse(); } diff --git a/FOSUserEvents.php b/FOSUserEvents.php index 274760e82d..af9b2e396c 100644 --- a/FOSUserEvents.php +++ b/FOSUserEvents.php @@ -258,13 +258,24 @@ final class FOSUserEvents /** * The RESETTING_SEND_EMAIL_COMPLETED event occurs after the email is sent. * - * This event allows you to set the response to bypass the the redirection after the email is sent. + * This event allows you to set the response to bypass the redirection after the email is sent. * The event listener method receives a FOS\UserBundle\Event\GetResponseUserEvent instance. * * @Event("FOS\UserBundle\Event\GetResponseUserEvent") */ const RESETTING_SEND_EMAIL_COMPLETED = 'fos_user.resetting.send_email.completed'; + /** + * The RESETTING_SEND_EMAIL_FAILURE event occurs whenever email is not send due to non-existing username + * or expired password request. + * + * This event allows you to set the response to bypass the redirection after the email is not sent. + * The event listener method receives a FOS\UserBundle\Event\GetResponseNullableUserEvent instance. + * + * @Event("FOS\UserBundle\Event\GetResponseNullableUserEvent") + */ + const RESETTING_SEND_EMAIL_FAILURE = 'fos_user.resetting.send_email.failure'; + /** * The USER_CREATED event occurs when the user is created with UserManipulator. * From 02f6a512b6be09c6f6e1db661372f905305dd861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ma=C5=82olepszy?= Date: Mon, 6 Aug 2018 21:50:29 +0200 Subject: [PATCH 2/2] Moves setting memory limit before invoking composer. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f0311bb7e5..845df49b65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,9 @@ cache: before_install: # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 + - echo "memory_limit=4G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi - if [ "$DEPENDENCIES" != "" ]; then composer require --no-update $DEPENDENCIES; fi; - - echo "memory_limit=4G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini install: composer update --prefer-dist --no-interaction $COMPOSER_FLAGS