vendor/eckinox/security-bundle/src/Form/ResetPasswordRequestFormType.php line 12

Open in your IDE?
  1. <?php
  2. namespace Eckinox\SecurityBundle\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Validator\Constraints\NotBlank;
  8. use Symfony\Component\HttpFoundation\RequestStack;
  9. class ResetPasswordRequestFormType extends AbstractType
  10. {
  11.     public function __construct(RequestStack $requestStack)
  12.     {
  13.         $this->request $requestStack->getCurrentRequest();
  14.     }
  15.     
  16.     public function buildForm(FormBuilderInterface $builder, array $options): void
  17.     {
  18.         $builder
  19.             ->add('email'EmailType::class, [
  20.                 'label' => 'eckinox_security.fields.email',
  21.                 'constraints' => [
  22.                     new NotBlank([
  23.                         'message' => 'Please enter your email',
  24.                     ]),
  25.                 ],
  26.                 'data' => $this->request->query->get('email')
  27.             ])
  28.         ;
  29.     }
  30.     public function configureOptions(OptionsResolver $resolver): void
  31.     {
  32.         $resolver->setDefaults([]);
  33.     }
  34. }