src/Controller/SecurityController.php line 20

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. class SecurityController extends AbstractController
  8. {
  9.     /**
  10.      * Page de login
  11.      *
  12.      * @Route("/login", name="app_login")
  13.      * @param AuthenticationUtils $authenticationUtils
  14.      * @template 'security/login.html.twig'
  15.      * @return Response
  16.      */
  17.     public function loginAction(AuthenticationUtils $authenticationUtils): Response
  18.     {
  19.         // Le service authentication_utils permet de récupérer le nom d'utilisateur
  20.         // et l'erreur dans le cas où le formulaire a déjà été soumis mais était invalide
  21.         // (mauvais mot de passe par exemple)
  22.         //$authenticationUtils = $this->get('security.authentication_utils');
  23.         return $this->render('security/login.html.twig', array(
  24.             'last_username' => $authenticationUtils->getLastUsername(),
  25.             'error'         => $authenticationUtils->getLastAuthenticationError(),
  26.         ));
  27.     }
  28.     /**
  29.      * Déconnexion de l'utilisateur
  30.      *
  31.      * @Route("/logout", name="app_logout")
  32.      */
  33.     public function logout()
  34.     {
  35.         //$this->getUser()->kdls();
  36.         //$this->getUser()->setLastDeconnexionAt(time());
  37.         //$this->getDoctrine()->getManager()->flush();
  38.     }
  39. }