Private
Public Access
chg: dev: remove registration notification #14
This commit is contained in:
@@ -18,7 +18,6 @@ use App\Repository\UserRepository;
|
|||||||
use App\Service\Email\SendActivationEmailService;
|
use App\Service\Email\SendActivationEmailService;
|
||||||
use App\Service\Email\SendPasswordResetEmailService;
|
use App\Service\Email\SendPasswordResetEmailService;
|
||||||
use App\Service\Email\SendUserActivationNotificationService;
|
use App\Service\Email\SendUserActivationNotificationService;
|
||||||
use App\Service\Email\SendUserRegistrationNotificationService;
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
@@ -55,7 +54,6 @@ class SecurityController extends AbstractController
|
|||||||
private readonly SendActivationEmailService $activationEmail,
|
private readonly SendActivationEmailService $activationEmail,
|
||||||
private readonly SendPasswordResetEmailService $passwordResetEmail,
|
private readonly SendPasswordResetEmailService $passwordResetEmail,
|
||||||
private readonly SendUserActivationNotificationService $activationNotificationEmail,
|
private readonly SendUserActivationNotificationService $activationNotificationEmail,
|
||||||
private readonly SendUserRegistrationNotificationService $registrationNotificationEmail,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +110,6 @@ class SecurityController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->activationEmail->send($user, $activationUrl);
|
$this->activationEmail->send($user, $activationUrl);
|
||||||
$this->registrationNotificationEmail->send($user, new DateTime());
|
|
||||||
|
|
||||||
$this->addFlash('verify_email', $user->email);
|
$this->addFlash('verify_email', $user->email);
|
||||||
|
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
<?php declare(strict_types=1);
|
|
||||||
/**
|
|
||||||
* This file is part of the SplendidBear Websites' projects.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 @ www.splendidbear.org
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the SplendidBear Websites' projects.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2026 @ www.splendidbear.org
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Service\Email;
|
|
||||||
|
|
||||||
use App\Entity\User;
|
|
||||||
use DateTime;
|
|
||||||
use Exception;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
use RuntimeException;
|
|
||||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
|
||||||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
|
||||||
use Symfony\Component\Mailer\MailerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class SendUserRegistrationNotificationService
|
|
||||||
*
|
|
||||||
* @package App\Service\Email
|
|
||||||
* @author Lang <https://www.splendidbear.org>
|
|
||||||
* @category Class
|
|
||||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
|
||||||
* @link www.splendidbear.org
|
|
||||||
* @since 2026. 04. 20.
|
|
||||||
*/
|
|
||||||
readonly final class SendUserRegistrationNotificationService
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
#[Autowire(env: 'APP_CONTACT_MAIL_ADDRESS')]
|
|
||||||
private string $appContactMailAddress,
|
|
||||||
private LoggerInterface $logger,
|
|
||||||
private MailerInterface $mailer,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function send(User $user, DateTime $registeredAt): void
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$this->mailer->send(
|
|
||||||
new TemplatedEmail()
|
|
||||||
->from('noreply@mineseeker.hu')
|
|
||||||
->to($this->appContactMailAddress)
|
|
||||||
->subject("🎉 New User Registration: {$user->getUsername()}")
|
|
||||||
->htmlTemplate('emails/user_registration_notification.html.twig')
|
|
||||||
->context([
|
|
||||||
'user' => $user,
|
|
||||||
'registeredAt' => $registeredAt,
|
|
||||||
])
|
|
||||||
);
|
|
||||||
} catch (TransportExceptionInterface|Exception $e) {
|
|
||||||
$this->logger->error("Failed to send user registration notification: {$e->getMessage()}", [
|
|
||||||
'exception' => $e,
|
|
||||||
'user' => $user->getUsername(),
|
|
||||||
]);
|
|
||||||
throw new RuntimeException("Failed to send user registration notification: {$e->getMessage()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>New User Registration</title>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
||||||
line-height: 1.6;
|
|
||||||
color: #333;
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
.header {
|
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
||||||
color: white;
|
|
||||||
padding: 30px;
|
|
||||||
border-radius: 8px 8px 0 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.header h1 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
.content {
|
|
||||||
background: #f9f9f9;
|
|
||||||
padding: 30px;
|
|
||||||
border-radius: 0 0 8px 8px;
|
|
||||||
}
|
|
||||||
.field {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
.field-label {
|
|
||||||
font-weight: 600;
|
|
||||||
color: #666;
|
|
||||||
font-size: 12px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.field-value {
|
|
||||||
background: white;
|
|
||||||
padding: 12px;
|
|
||||||
border-radius: 4px;
|
|
||||||
border-left: 3px solid #667eea;
|
|
||||||
}
|
|
||||||
.footer {
|
|
||||||
margin-top: 20px;
|
|
||||||
padding-top: 20px;
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #999;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="header">
|
|
||||||
<h1>👤 New User Registration</h1>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<div class="field">
|
|
||||||
<div class="field-label">Username</div>
|
|
||||||
<div class="field-value">
|
|
||||||
<strong>{{ user.username }}</strong>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<div class="field-label">Email</div>
|
|
||||||
<div class="field-value">
|
|
||||||
<a href="mailto:{{ user.email }}">{{ user.email }}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<div class="field-label">Details</div>
|
|
||||||
<div class="field-value">
|
|
||||||
<strong>Registered:</strong> {{ registeredAt|date('Y-m-d H:i:s') }}<br>
|
|
||||||
<strong>Status:</strong> {% if user.isVerified %}✓ Verified{% else %}⏳ Awaiting Email Verification{% endif %}<br>
|
|
||||||
<strong>Email Verified:</strong> {% if user.isVerified %}Yes{% else %}No - activation link sent{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
A new user has registered on MineSeeker.<br>
|
|
||||||
User must verify their email before account is fully activated.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user