Skip to content

Commit 10875cb

Browse files
authored
Merge pull request #2764 from benjaminb-/master
Redirect to login when using confirmation token already used or not found
2 parents d3c0d32 + 8c73318 commit 10875cb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Controller/RegistrationController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use Symfony\Component\HttpFoundation\Request;
2525
use Symfony\Component\HttpFoundation\Response;
2626
use Symfony\Component\HttpFoundation\Session\SessionInterface;
27-
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2827
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
2928
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
3029

@@ -139,7 +138,7 @@ public function confirmAction(Request $request, $token)
139138
$user = $userManager->findUserByConfirmationToken($token);
140139

141140
if (null === $user) {
142-
throw new NotFoundHttpException(sprintf('The user with confirmation token "%s" does not exist', $token));
141+
return new RedirectResponse($this->container->get('router')->generate('fos_user_security_login'));
143142
}
144143

145144
$user->setConfirmationToken(null);

0 commit comments

Comments
 (0)