src/Controller/Security/SecurityController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Security;
  3. use App\Service\GestionComerciale\EmailService;
  4. use Doctrine\ORM\EntityManagerInterface;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use App\Entity\Utilisateur\Utilisateur;
  11. use Symfony\Component\Security\Csrf\CsrfToken;
  12. use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
  13. use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  14. class SecurityController extends AbstractController
  15. {
  16.     /**
  17.      * @Route("/login", name="login")
  18.      */
  19.     public function login(AuthenticationUtils $authenticationUtils): Response
  20.     {
  21.         // if ($this->getUser()) {
  22.         //     return $this->redirectToRoute('target_path');
  23.         // }
  24.         // get the login error if there is one
  25.         $error $authenticationUtils->getLastAuthenticationError();
  26.         // last username entered by the user
  27.         $lastUsername $authenticationUtils->getLastUsername();
  28.         return $this->render(
  29.             'Security/login.html.twig',
  30.             [
  31.                 'last_username' => $lastUsername,
  32.                 'error'         => $error,
  33.                 'meta'                  => [
  34.                     'title'       => 'Login',
  35.                     'description' => '',
  36.                 ],
  37.             ]
  38.         );
  39.     }
  40.     /**
  41.      * @Route("/logout", name="logout")
  42.      */
  43.     public function logout()
  44.     {
  45.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  46.     }
  47. }