diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index c66bf0b..9b3fd54 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -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'); diff --git a/templates/emails/user_activation_notification.html.twig b/templates/emails/user_activation_notification.html.twig new file mode 100644 index 0000000..037d1f9 --- /dev/null +++ b/templates/emails/user_activation_notification.html.twig @@ -0,0 +1,92 @@ + + + + + User Account Activated + + + +
+

✅ User Account Activated

+
+
+
+
Username
+
+ {{ user.username }} +
+
+ +
+
Email
+ +
+ +
+
Details
+
+ Activated: {{ activatedAt|date('Y-m-d H:i:s') }}
+ Status: ✓ Email Verified - Account Active
+ Email Verified: Yes +
+
+ + +
+ + diff --git a/templates/emails/user_registration_notification.html.twig b/templates/emails/user_registration_notification.html.twig index 7a166dd..fc4ffbe 100644 --- a/templates/emails/user_registration_notification.html.twig +++ b/templates/emails/user_registration_notification.html.twig @@ -90,4 +90,3 @@ -