Skip to content

Commit 9191aec

Browse files
committed
bug #646 redirect to check email route on failure (jrushlow)
This PR was squashed before being merged into the 1.0-dev branch. Discussion ---------- redirect to check email route on failure default to failing silently on a reset password request in the `ResetPasswordController`. This will prevent the actual cause of the failure (user throttle limit, unknown user, etc..) from being displayed. We also redirect to the check email route by default. The user has the option to reveal the cause of the failure via a flash or, preferably, implementing a logging solution to store the error message. Commits ------- e2161b9 redirect to check email route on failure
2 parents 4705242 + e2161b9 commit 9191aec

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,16 @@ private function processSendingPasswordResetEmail(string $emailFormData, MailerI
147147
try {
148148
$resetToken = $this->resetPasswordHelper->generateResetToken($user);
149149
} catch (ResetPasswordExceptionInterface $e) {
150-
$this->addFlash('reset_password_error', sprintf(
151-
'There was a problem handling your password reset request - %s',
152-
$e->getReason()
153-
));
150+
// If you want to tell the user why a reset email was not sent, uncomment
151+
// the lines below and change the redirect to 'app_forgot_password_request'.
152+
// Caution: This may reveal if a user is registered or not.
153+
//
154+
// $this->addFlash('reset_password_error', sprintf(
155+
// 'There was a problem handling your password reset request - %s',
156+
// $e->getReason()
157+
// ));
154158

155-
return $this->redirectToRoute('app_forgot_password_request');
159+
return $this->redirectToRoute('app_check_email');
156160
}
157161

158162
$email = (new TemplatedEmail())

0 commit comments

Comments
 (0)