src/Controller/Admin/SecurityController.php line 14

  1. <?php
  2. namespace App\Controller\Admin;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Bundle\SecurityBundle\Security;
  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(path'/admin/login'name'app_login')]
  11.     public function login(AuthenticationUtils $authenticationUtils): Response
  12.     {
  13.         $error $authenticationUtils->getLastAuthenticationError();
  14.         $lastUsername $authenticationUtils->getLastUsername();
  15.         return $this->render('admin/login.html.twig', [
  16.             'last_username' => $lastUsername,
  17.             'error' => $error,
  18.         ]);
  19.     }
  20.     #[Route('/admin/logout'name'app_logout'methods: ['GET'])]
  21.     public function logout(Security $security)
  22.     {
  23.         // controller can be blank: it will never be called!
  24.         throw new \Exception('Don\'t forget to activate logout in security.yaml');
  25.     }
  26. }