Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds RESETTING_SEND_EMAIL_FAILURE. #2829

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions Controller/ResettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
13 changes: 12 additions & 1 deletion FOSUserEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down