src/Controller/SecurityController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. #[Route(''name'security_')]
  8. class SecurityController extends AbstractController
  9. {
  10.     #[Route('/login'name'login')]
  11.     public function login(AuthenticationUtils $authenticationUtils): Response
  12.     {
  13.         if ($this->getUser()) {
  14.             return $this->redirectToRoute('main_home');
  15.         }
  16.         $error $authenticationUtils->getLastAuthenticationError();
  17.         $lastUsername $authenticationUtils->getLastUsername();
  18.         return $this->render('security/login.html.twig', [
  19.             'error' => $error,
  20.             'lastUsername' => $lastUsername,
  21.         ]);
  22.     }
  23.     #[Route('/logout''logout')]
  24.     public function logout(): void
  25.     {
  26.     }
  27. }