@@ -34,15 +34,16 @@ public function __construct(ResetPasswordHelperInterface $resetPasswordHelper, E
34
34
* @Route("", name="app_forgot_password_request")
35
35
*/
36
36
<?php } ?>
37
- public function request(Request $request, MailerInterface $mailer): Response
37
+ public function request(Request $request, MailerInterface $mailer<?php if ( $ translator_available ): ?> , TranslatorInterface $translator <?php endif ?> ): Response
38
38
{
39
39
$form = $this->createForm(<?= $ request_form_type_class_name ?> ::class);
40
40
$form->handleRequest($request);
41
41
42
42
if ($form->isSubmitted() && $form->isValid()) {
43
43
return $this->processSendingPasswordResetEmail(
44
44
$form->get('<?= $ email_field ?> ')->getData(),
45
- $mailer
45
+ $mailer<?php if ($ translator_available ): ?> ,
46
+ $translator<?php endif ?> <?= "\n" ?>
46
47
);
47
48
}
48
49
@@ -84,7 +85,7 @@ public function checkEmail(): Response
84
85
* @Route("/reset/{token}", name="app_reset_password")
85
86
*/
86
87
<?php } ?>
87
- public function reset(Request $request, <?= $ password_hasher_class_details ->getShortName () ?> <?= $ password_hasher_variable_name ?> , string $token = null): Response
88
+ public function reset(Request $request, <?= $ password_hasher_class_details ->getShortName () ?> <?= $ password_hasher_variable_name ?> <?php if ( $ translator_available ): ?> , TranslatorInterface $translator <?php endif ?> , string $token = null): Response
88
89
{
89
90
if ($token) {
90
91
// We store the token in session and remove it from the URL, to avoid the URL being
@@ -103,8 +104,9 @@ public function reset(Request $request, <?= $password_hasher_class_details->getS
103
104
$user = $this->resetPasswordHelper->validateTokenAndFetchUser($token);
104
105
} catch (ResetPasswordExceptionInterface $e) {
105
106
$this->addFlash('reset_password_error', sprintf(
106
- 'There was a problem validating your reset request - %s',
107
- $e->getReason()
107
+ '%s - %s',
108
+ <?php if ($ translator_available ): ?> $translator->trans(<?= $ problem_validate_message_or_constant ?> , [], 'ResetPasswordBundle')<?php else : ?> <?= $ problem_validate_message_or_constant ?> <?php endif ?> ,
109
+ <?php if ($ translator_available ): ?> $translator->trans($e->getReason(), [], 'ResetPasswordBundle')<?php else : ?> $e->getReason()<?php endif ?> <?= "\n" ?>
108
110
));
109
111
110
112
return $this->redirectToRoute('app_forgot_password_request');
@@ -138,7 +140,7 @@ public function reset(Request $request, <?= $password_hasher_class_details->getS
138
140
]);
139
141
}
140
142
141
- private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer): RedirectResponse
143
+ private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer<?php if ( $ translator_available ): ?> , TranslatorInterface $translator <?php endif ?> ): RedirectResponse
142
144
{
143
145
$user = $this->entityManager->getRepository(<?= $ user_class_name ?> ::class)->findOneBy([
144
146
'<?= $ email_field ?> ' => $emailFormData,
@@ -157,8 +159,9 @@ private function processSendingPasswordResetEmail(string $emailFormData, MailerI
157
159
// Caution: This may reveal if a user is registered or not.
158
160
//
159
161
// $this->addFlash('reset_password_error', sprintf(
160
- // 'There was a problem handling your password reset request - %s',
161
- // $e->getReason()
162
+ // '%s - %s',
163
+ // <?php if ($ translator_available ): ?> $translator->trans(<?= $ problem_handle_message_or_constant ?> , [], 'ResetPasswordBundle')<?php else : ?> <?= $ problem_handle_message_or_constant ?> <?php endif ?> ,
164
+ // <?php if ($ translator_available ): ?> $translator->trans($e->getReason(), [], 'ResetPasswordBundle')<?php else : ?> $e->getReason()<?php endif ?> <?= "\n" ?>
162
165
// ));
163
166
164
167
return $this->redirectToRoute('app_check_email');
0 commit comments