<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Security\Http\SecurityEvents;
use Symfony\Contracts\EventDispatcher\Event;
use Symfony\Component\BrowserKit\Cookie;
//use App\Security\LoginFormAuthenticator;
use App\Security\LoginFormAuthenticator;
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
use App\Entity\Usuario;
use Symfony\Component\Security\Http\Util\TargetPathTrait;
//use Symfony\Component\HttpFoundation\Session\Session;
class SecurityController extends AbstractController
{
use TargetPathTrait;
/**
* @Route("/login", name="login")
*/
public function login(AuthenticationUtils $authenticationUtils, RequestStack $requestStack, Request $request)
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
$session = $requestStack->getSession();
$tramiteId = $request->get('t');
if (!empty($tramiteId)){
$session->set('ext_tramiteId', $tramiteId);
}
return $this->render('security/login.html.twig', array(
'last_username' => $lastUsername,
'error' => $error,
'cuenta_confirmada' => $session->get('cuenta_confirmada'),
));
}
}