Verification done? Try many + 5

This commit is contained in:
Frank
2026-01-16 22:47:42 +01:00
parent ec9e486b4a
commit 23b12efeea
2 changed files with 22 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ class ActivationController extends AbstractController
try { try {
$emailVerifier->handleEmailConfirmation($request, $user); $emailVerifier->handleEmailConfirmation($request, $user);
} catch (VerifyEmailExceptionInterface $exception) { } catch (VerifyEmailExceptionInterface $exception) {
$this->addFlash('error', $exception->getReason() . ' If the link has expired, you can <a href="' . $this->generateUrl('app_verify_resend_email') . '">request a new one here</a>.'); $this->addFlash('error', $exception->getReason() . ' If the link has expired, you can request a new one through the email</a>.');
return $this->redirectToRoute('app_register'); return $this->redirectToRoute('app_register');
} }

View File

@@ -78,6 +78,27 @@ class EmailVerifier
if (isset($parts['port'])) { if (isset($parts['port'])) {
$request->server->set('SERVER_PORT', $parts['port']); $request->server->set('SERVER_PORT', $parts['port']);
} }
if (isset($parts['path'])) {
$baseUrl = rtrim($parts['path'], '/');
$request->server->set('SCRIPT_NAME', $baseUrl . '/index.php');
$request->server->set('SCRIPT_FILENAME', $baseUrl . '/index.php');
// Prepend base path to REQUEST_URI if not already there
$requestUri = $request->server->get('REQUEST_URI');
if (str_starts_with($requestUri, '/') && !str_starts_with($requestUri, $baseUrl . '/')) {
$request->server->set('REQUEST_URI', $baseUrl . $requestUri);
}
// Force Request to re-calculate internal properties
$reflection = new \ReflectionObject($request);
foreach (['baseUrl', 'pathInfo', 'requestUri'] as $propName) {
if ($reflection->hasProperty($propName)) {
$prop = $reflection->getProperty($propName);
$prop->setAccessible(true);
$prop->setValue($request, null);
}
}
}
} }
$this->verifyEmailHelper->validateEmailConfirmationFromRequest($request, (string) $user->getId(), $user->getEmail()); $this->verifyEmailHelper->validateEmailConfirmationFromRequest($request, (string) $user->getId(), $user->getEmail());