Added domain to verification mail
This commit is contained in:
@@ -7,6 +7,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||||
use Symfony\Component\Mailer\MailerInterface;
|
use Symfony\Component\Mailer\MailerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
|
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
|
||||||
use SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface;
|
use SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface;
|
||||||
|
|
||||||
@@ -15,12 +16,34 @@ class EmailVerifier
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
private VerifyEmailHelperInterface $verifyEmailHelper,
|
private VerifyEmailHelperInterface $verifyEmailHelper,
|
||||||
private MailerInterface $mailer,
|
private MailerInterface $mailer,
|
||||||
private EntityManagerInterface $entityManager
|
private EntityManagerInterface $entityManager,
|
||||||
|
private UrlGeneratorInterface $router
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendEmailConfirmation(string $verifyEmailRouteName, User $user, TemplatedEmail $email): void
|
public function sendEmailConfirmation(string $verifyEmailRouteName, User $user, TemplatedEmail $email): void
|
||||||
{
|
{
|
||||||
|
$context = $this->router->getContext();
|
||||||
|
if (empty($context->getHost())) {
|
||||||
|
$siteBaseUrl = $_ENV['SITE_BASE_URL'] ?? null;
|
||||||
|
if ($siteBaseUrl) {
|
||||||
|
$parts = parse_url($siteBaseUrl);
|
||||||
|
if (isset($parts['host'])) {
|
||||||
|
$context->setHost($parts['host']);
|
||||||
|
}
|
||||||
|
if (isset($parts['scheme'])) {
|
||||||
|
$context->setScheme($parts['scheme']);
|
||||||
|
}
|
||||||
|
if (isset($parts['port'])) {
|
||||||
|
if ('http' === $parts['scheme']) {
|
||||||
|
$context->setHttpPort($parts['port']);
|
||||||
|
} elseif ('https' === $parts['scheme']) {
|
||||||
|
$context->setHttpsPort($parts['port']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$signatureComponents = $this->verifyEmailHelper->generateSignature(
|
$signatureComponents = $this->verifyEmailHelper->generateSignature(
|
||||||
$verifyEmailRouteName,
|
$verifyEmailRouteName,
|
||||||
(string) $user->getId(),
|
(string) $user->getId(),
|
||||||
|
|||||||
Reference in New Issue
Block a user