diff --git a/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php b/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php index 8d61cf325..2ce3c2b13 100644 --- a/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php +++ b/src/Resources/skeleton/resetPassword/ResetPasswordController.tpl.php @@ -16,10 +16,12 @@ class extends AbstractController use ResetPasswordControllerTrait; private $resetPasswordHelper; + private $entityManager; - public function __construct(ResetPasswordHelperInterface $resetPasswordHelper) + public function __construct(ResetPasswordHelperInterface $resetPasswordHelper, EntityManagerInterface $entityManager) { $this->resetPasswordHelper = $resetPasswordHelper; + $this->entityManager = $entityManager; } /** @@ -82,7 +84,7 @@ public function checkEmail(): Response * @Route("/reset/{token}", name="app_reset_password") */ - public function reset(Request $request, getShortName() ?> , EntityManagerInterface $entityManager, string $token = null): Response + public function reset(Request $request, getShortName() ?> , string $token = null): Response { if ($token) { // We store the token in session and remove it from the URL, to avoid the URL being @@ -123,7 +125,7 @@ public function reset(Request $request, getS ); $user->($encodedPassword); - $entityManager->flush(); + $this->entityManager->flush(); // The session is cleaned up after the password has been changed. $this->cleanSessionAfterReset(); @@ -136,9 +138,9 @@ public function reset(Request $request, getS ]); } - private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer, EntityManagerInterface $entityManager): RedirectResponse + private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer): RedirectResponse { - $user = $entityManager->getRepository(::class)->findOneBy([ + $user = $this->entityManager->getRepository(::class)->findOneBy([ '' => $emailFormData, ]);