src/Controller/AccountController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. class AccountController extends AbstractController
  8. {
  9.     /**
  10.      * Formulaire de connexion
  11.      *
  12.      * @Route("/login", name="account_login")
  13.      *
  14.      * @param AuthenticationUtils $utils
  15.      * @return Response
  16.      */
  17.     public function login(AuthenticationUtils $utils): Response
  18.     {
  19.         $error $utils->getLastAuthenticationError();
  20.         $username $utils->getLastUsername();
  21.         if ($this->isGranted('ROLE_ADMIN') or $this->isGranted('ROLE_USER')) {
  22.             return $this->redirectToRoute('home');
  23.         }
  24.         return $this->render('account/login.html.twig', [
  25.             'hasError' => $error!==null,
  26.             'username' => $username
  27.         ]);
  28.     }
  29.     /**
  30.      * Deconnexion
  31.      *
  32.      * @Route("/logout", name="account_logout")
  33.      *
  34.      * @return void
  35.      */
  36.     public function logout()
  37.     {
  38.         //rien
  39.     }
  40. }