diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 3eb0fd1e1..6a4271bd0 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -49,8 +49,6 @@ security: #always_remember_me: true logout: - # The route name the user can go to in order to logout - path: security_logout # The name of the route to redirect to after logging out target: homepage # Secure the logout against CSRF diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index e1346883e..1b724fa07 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -59,16 +59,4 @@ public function login( 'error' => $helper->getLastAuthenticationError(), ]); } - - /** - * This is the route the user can use to logout. - * - * But, this will never be executed. Symfony will intercept this first - * and handle the logout automatically. See logout in config/packages/security.yaml - */ - #[Route('/logout', name: 'security_logout')] - public function logout(): void - { - throw new \Exception('This should never be reached!'); - } } diff --git a/tests/Controller/UserControllerTest.php b/tests/Controller/UserControllerTest.php index 023071fe7..f7b80a241 100644 --- a/tests/Controller/UserControllerTest.php +++ b/tests/Controller/UserControllerTest.php @@ -104,7 +104,7 @@ public function testChangePassword(): void $this->assertResponseRedirects(); $this->assertStringStartsWith( - '/en/logout', + '/logout', $client->getResponse()->headers->get('Location') ?? '', 'Changing password logout the user.' );