Private
Public Access
1
0

chg: usr: add notification on activation too #4
All checks were successful
Deploy to Production / deploy (push) Successful in 11s

This commit is contained in:
2026-04-15 20:23:41 +02:00
parent 588fb57299
commit 8795fedda9
3 changed files with 106 additions and 2 deletions

View File

@@ -229,7 +229,7 @@ class SecurityController extends AbstractController
}
#[Route('/activate/{token}', name: 'MineSeekerBundle_activate')]
public function activate(string $token, EntityManagerInterface $em): Response
public function activate(string $token, EntityManagerInterface $em, MailerInterface $mailer): Response
{
$user = $em->getRepository(User::class)->findOneBy(['verificationToken' => $token]);
@@ -241,6 +241,19 @@ class SecurityController extends AbstractController
$user->setIsVerified(true)->setVerificationToken(null);
$em->flush();
/** Send admin notification about account activation */
$mailer->send(
new TemplatedEmail()
->from('noreply@mineseeker.hu')
->to($this->appContactMailAddress)
->subject('✅ User Account Activated: ' . $user->getUsername())
->htmlTemplate('emails/user_activation_notification.html.twig')
->context([
'user' => $user,
'activatedAt' => new DateTime(),
])
);
$this->addFlash('success', 'Your account is now active. Welcome, ' . $user->getUsername() . '!');
return $this->redirectToRoute('MineSeekerBundle_login');