diff --git a/app/.env.local b/app/.env.local index e809a14..9a8a104 100644 --- a/app/.env.local +++ b/app/.env.local @@ -31,7 +31,7 @@ DATABASE_URL="mysql://lux_admin:&pHDG3%LcV@database:3306/lux?serverVersion=8.0" # DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8" ###< doctrine/doctrine-bundle ### -MAIL_TO_ADDRESS=mspm88@yandex.ru +ADMIN_EMAIL=ins_admin@insurance.com ###> symfony/lock ### # Choose one of the stores below diff --git a/app/config/services.yaml b/app/config/services.yaml index 1ab91fb..c47915c 100644 --- a/app/config/services.yaml +++ b/app/config/services.yaml @@ -5,13 +5,15 @@ # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: photoDir: "%kernel.project_dir%/public/uploads/photos" - sendTo: '%env(MAIL_TO_ADDRESS)%' + default_admin_email: 'admin@insurance.com' services: # default configuration for services in *this* file _defaults: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + bind: + $adminEmail: "%env(string:default:default_admin_email:ADMIN_EMAIL)%" # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name diff --git a/app/src/Controller/RegistrationController.php b/app/src/Controller/RegistrationController.php index ac914fc..ef5dae6 100644 --- a/app/src/Controller/RegistrationController.php +++ b/app/src/Controller/RegistrationController.php @@ -24,7 +24,7 @@ public function __construct(EmailVerifier $emailVerifier) } #[Route('/register', name: 'app_register')] - public function register(Request $request, UserPasswordHasherInterface $passwordHasher): Response + public function register(Request $request, UserPasswordHasherInterface $passwordHasher, string $adminEmail): Response { $user = new User(); $form = $this->createForm(RegistrationFormType::class, $user); @@ -46,7 +46,7 @@ public function register(Request $request, UserPasswordHasherInterface $password // generate a signed url and email it to the user $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user, (new TemplatedEmail()) - ->from(new Address('vismark47@gmail.com', 'Insurance Mail Bot')) + ->from(new Address($adminEmail, 'Insurance Mail Bot')) ->to($user->getEmail()) ->subject('Please Confirm your Email') ->htmlTemplate('registration/confirmation_email.html.twig') @@ -78,6 +78,6 @@ public function verifyUserEmail(Request $request): Response // @TODO Change the redirect on success and handle or remove the flash message in your templates $this->addFlash('success', 'Your email address has been verified.'); - return $this->redirectToRoute('app_register'); + return $this->redirectToRoute('homepage'); } } diff --git a/app/src/Controller/ResetPasswordController.php b/app/src/Controller/ResetPasswordController.php index 9011079..e4b8c01 100644 --- a/app/src/Controller/ResetPasswordController.php +++ b/app/src/Controller/ResetPasswordController.php @@ -65,6 +65,7 @@ public function checkEmail(): Response return $this->render('reset_password/check_email.html.twig', [ 'resetToken' => $resetToken, + 'title' => 'Password Reset Email Sent' ]); } @@ -126,7 +127,7 @@ public function reset(Request $request, UserPasswordHasherInterface $passwordHas ]); } - private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer): RedirectResponse + private function processSendingPasswordResetEmail(string $emailFormData, MailerInterface $mailer, string $adminEmail): RedirectResponse { $user = $this->getDoctrine()->getRepository(User::class)->findOneBy([ 'email' => $emailFormData, @@ -153,7 +154,7 @@ private function processSendingPasswordResetEmail(string $emailFormData, MailerI } $email = (new TemplatedEmail()) - ->from(new Address('vismark47@gmail.com', 'Insurance Mail Bot')) + ->from(new Address($adminEmail, 'Insurance Mail Bot')) ->to($user->getEmail()) ->subject('Your password reset request') ->htmlTemplate('reset_password/email.html.twig') diff --git a/app/templates/base.html.twig b/app/templates/base.html.twig index 0bfdade..2610e63 100644 --- a/app/templates/base.html.twig +++ b/app/templates/base.html.twig @@ -32,7 +32,7 @@ {% endif %} - {% if app.request.attributes.get('_route') != "homepage" and app.request.attributes.get('_route') != "app_login" and app.request.attributes.get('_route') != "app_forgot_password_request" and app.request.attributes.get('_route') != "app_register" %} + {% if app.request.attributes.get('_route') != "homepage" and app.request.attributes.get('_route') != "app_login" and app.request.attributes.get('_route') != "app_forgot_password_request" and app.request.attributes.get('_route') != "app_register" and app.request.attributes.get('_route') != "app_check_email" %}