Verification mails solving try 1
This commit is contained in:
@@ -7,7 +7,6 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
|
||||
use SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface;
|
||||
|
||||
@@ -16,34 +15,12 @@ class EmailVerifier
|
||||
public function __construct(
|
||||
private VerifyEmailHelperInterface $verifyEmailHelper,
|
||||
private MailerInterface $mailer,
|
||||
private EntityManagerInterface $entityManager,
|
||||
private UrlGeneratorInterface $router
|
||||
private EntityManagerInterface $entityManager
|
||||
) {
|
||||
}
|
||||
|
||||
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(
|
||||
$verifyEmailRouteName,
|
||||
(string) $user->getId(),
|
||||
|
||||
Reference in New Issue
Block a user