<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
/**
* Page de login
*
* @Route("/login", name="app_login")
* @param AuthenticationUtils $authenticationUtils
* @template 'security/login.html.twig'
* @return Response
*/
public function loginAction(AuthenticationUtils $authenticationUtils): Response
{
// Le service authentication_utils permet de récupérer le nom d'utilisateur
// et l'erreur dans le cas où le formulaire a déjà été soumis mais était invalide
// (mauvais mot de passe par exemple)
//$authenticationUtils = $this->get('security.authentication_utils');
return $this->render('security/login.html.twig', array(
'last_username' => $authenticationUtils->getLastUsername(),
'error' => $authenticationUtils->getLastAuthenticationError(),
));
}
/**
* Déconnexion de l'utilisateur
*
* @Route("/logout", name="app_logout")
*/
public function logout()
{
//$this->getUser()->kdls();
//$this->getUser()->setLastDeconnexionAt(time());
//$this->getDoctrine()->getManager()->flush();
}
}