diff --git a/src/Tech/Controller/ActivationController.php b/src/Tech/Controller/ActivationController.php index c2dcc3b..7936c94 100644 --- a/src/Tech/Controller/ActivationController.php +++ b/src/Tech/Controller/ActivationController.php @@ -31,7 +31,7 @@ class ActivationController extends AbstractController try { $emailVerifier->handleEmailConfirmation($request, $user); } catch (VerifyEmailExceptionInterface $exception) { - $this->addFlash('error', $exception->getReason() . ' If the link has expired, you can request a new one here.'); + $this->addFlash('error', $exception->getReason() . ' If the link has expired, you can request a new one through the email.'); return $this->redirectToRoute('app_register'); } diff --git a/src/Tech/Service/EmailVerifier.php b/src/Tech/Service/EmailVerifier.php index 9bdc571..0e4b086 100644 --- a/src/Tech/Service/EmailVerifier.php +++ b/src/Tech/Service/EmailVerifier.php @@ -78,6 +78,27 @@ class EmailVerifier if (isset($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());