Verification mails solving try 1
This commit is contained in:
@@ -35,9 +35,9 @@ server {
|
||||
fastcgi_param HTTPS $https if_not_empty;
|
||||
# Standard forwarded headers
|
||||
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
||||
fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto;
|
||||
fastcgi_param HTTP_X_FORWARDED_HOST $http_x_forwarded_host;
|
||||
fastcgi_param HTTP_X_FORWARDED_PORT $http_x_forwarded_port;
|
||||
fastcgi_param HTTP_X_FORWARDED_PROTO $scheme;
|
||||
fastcgi_param HTTP_X_FORWARDED_HOST $host;
|
||||
fastcgi_param HTTP_X_FORWARDED_PORT $server_port;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
|
||||
@@ -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