src/Controller/SecurityController.php line 14

  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(path"/login"name"login")]
  11.     public function login(AuthenticationUtils $authenticationUtils): Response
  12.     {
  13.         $error $authenticationUtils->getLastAuthenticationError();
  14.         $lastUsername $authenticationUtils->getLastUsername();
  15.         return $this->render('@EasyAdmin/page/login.html.twig', [
  16.             'error' => $error,
  17.             'last_username' => $lastUsername,
  18.             'remember_me_enabled' => true,
  19.         ]);
  20.     }
  21.     #[Route(path"/logout"name"logout",  methods: ["GET"])]
  22.     public function logout(): void
  23.     {
  24.         throw new Exception('Don\'t forget to activate logout in security.yaml');
  25.     }
  26. }