src/Controller/SecurityController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Exception;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. class SecurityController extends AbstractController
  9. {
  10.     #[Route('/login'name'app_login')]
  11.     public function index(AuthenticationUtils $authenticationUtils): Response
  12.     {
  13.         $error $authenticationUtils->getLastAuthenticationError();
  14.         $lastUsername $authenticationUtils->getLastUsername();
  15.         return $this->render('login/index.html.twig', [
  16.             'last_username' => $lastUsername,
  17.             'error' => $error,
  18.         ]);
  19.     }
  20.     #[Route('/logout'name'app_logout'methods: ['GET'])]
  21.     public function logout()
  22.     {
  23.         throw new Exception('Don\'t forget to activate logout in security.yaml');
  24.     }
  25. }