src/Controller/SecurityController.php line 54

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\RequestStack;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\HttpFoundation\RedirectResponse;
  10. use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
  11. use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
  12. use Symfony\Component\EventDispatcher\EventDispatcher;
  13. use Symfony\Component\Security\Http\SecurityEvents;
  14. use Symfony\Contracts\EventDispatcher\Event;
  15. use Symfony\Component\BrowserKit\Cookie;
  16. //use App\Security\LoginFormAuthenticator;
  17. use App\Security\LoginFormAuthenticator;
  18. use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
  19. use App\Entity\Usuario;
  20. use Symfony\Component\Security\Http\Util\TargetPathTrait;
  21. //use Symfony\Component\HttpFoundation\Session\Session;
  22. class SecurityController extends AbstractController
  23. {
  24.     use TargetPathTrait;
  25.     /**
  26.      * @Route("/login", name="login")
  27.      */
  28.     public function login(AuthenticationUtils $authenticationUtilsRequestStack $requestStackRequest $request)
  29.     {
  30.         // get the login error if there is one
  31.         $error $authenticationUtils->getLastAuthenticationError();
  32.         // last username entered by the user
  33.         $lastUsername $authenticationUtils->getLastUsername();
  34.         $session $requestStack->getSession();
  35.         $tramiteId $request->get('t');
  36.         if (!empty($tramiteId)){
  37.             $session->set('ext_tramiteId'$tramiteId);
  38.         }
  39.         return $this->render('security/login.html.twig', array(
  40.             'last_username' => $lastUsername,
  41.             'error'         => $error,
  42.             'cuenta_confirmada' => $session->get('cuenta_confirmada'),
  43.         ));
  44.     }
  45. }