<?php
namespace App\Form;
use App\EventListener\ReCaptchaValidationListener;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Form\AbstractType;
use Gregwar\CaptchaBundle\Type\CaptchaType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Csrf\TokenStorage\TokenStorageInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
class LoginType extends AbstractType
{
/**
* Campos del formulario de login (Fase A UX).
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('_username', null, [
'attr' => [
'class' => 'form-control m-input form-control-input-login',
'placeholder' => 'Usuario',
'autocomplete' => 'username',
'autofocus' => true,
],
'label' => 'Usuario',
'label_attr' => ['class' => 'col-lg-2 col-form-label'],
'required' => true,
])
->add('_password', PasswordType::class, [
'attr' => [
'class' => 'form-control m-input m-login__form-input--last form-control-input-login',
'placeholder' => 'Contraseña',
'autocomplete' => 'current-password',
'id' => 'login_password',
],
'label' => 'Contraseña',
'label_attr' => ['class' => 'col-lg-2 col-form-label'],
'required' => true,
])
->add('captcha', CaptchaType::class, [
'attr' => [
'class' => 'form-control form-control-input-login',
'placeholder' => 'Código CAPTCHA',
'autocomplete' => 'off',
'autocapitalize' => 'characters',
'spellcheck' => 'false',
],
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
// Configure your form options here
]);
}
}