From 8574836332f8ba0b81564fb9c2cfecb6485dc794 Mon Sep 17 00:00:00 2001 From: Marat Salakhov Date: Fri, 1 Apr 2022 23:01:04 +0300 Subject: [PATCH] fixed sending restore password email bug --- app/src/Controller/ResetPasswordController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/Controller/ResetPasswordController.php b/app/src/Controller/ResetPasswordController.php index e4b8c01..7353256 100644 --- a/app/src/Controller/ResetPasswordController.php +++ b/app/src/Controller/ResetPasswordController.php @@ -24,10 +24,12 @@ class ResetPasswordController extends AbstractController use ResetPasswordControllerTrait; private $resetPasswordHelper; + private $adminEmail; - public function __construct(ResetPasswordHelperInterface $resetPasswordHelper) + public function __construct(ResetPasswordHelperInterface $resetPasswordHelper, string $adminEmail) { $this->resetPasswordHelper = $resetPasswordHelper; + $this->adminEmail = $adminEmail; } /** @@ -127,7 +129,7 @@ public function reset(Request $request, UserPasswordHasherInterface $passwordHas ]); } - private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer, string $adminEmail): RedirectResponse + private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer): RedirectResponse { $user = $this->getDoctrine()->getRepository(User::class)->findOneBy([ 'email' => $emailFormData, @@ -154,7 +156,7 @@ private function processSendingPasswordResetEmail(string $emailFormData, MailerI } $email = (new TemplatedEmail()) - ->from(new Address($adminEmail, 'Insurance Mail Bot')) + ->from(new Address($this->adminEmail, 'Insurance Mail Bot')) ->to($user->getEmail()) ->subject('Your password reset request') ->htmlTemplate('reset_password/email.html.twig')