-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed def admin email; fixed redirect after mail confirmation url
- Loading branch information
1 parent
a1557ef
commit bf3aeff
Showing
6 changed files
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ DATABASE_URL="mysql://lux_admin:&pHDG3%LcV@database:3306/lux?serverVersion=8.0" | |
# DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
###< doctrine/doctrine-bundle ### | ||
|
||
MAIL_TO_ADDRESS=[email protected] | ||
ADMIN_EMAIL=[email protected] | ||
|
||
###> symfony/lock ### | ||
# Choose one of the stores below | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: '[email protected]' | ||
|
||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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('[email protected]', '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'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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('[email protected]', 'Insurance Mail Bot')) | ||
->from(new Address($adminEmail, 'Insurance Mail Bot')) | ||
->to($user->getEmail()) | ||
->subject('Your password reset request') | ||
->htmlTemplate('reset_password/email.html.twig') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters