Commit c2186b2c authored by reminec's avatar reminec
Browse files

No more use of form register

parent 7a175310
Pipeline #343042 failed with stage
in 5 minutes and 18 seconds
<?php
declare(strict_types=1);
namespace App\Form;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* IMPORTANT NOTE
* HashedPasswordType expects password to ba an associative array like so: ['plain'=>'$3çREt!'}
*
* Class RegistrationType
* @package App\Form
*/
final class RegistrationType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('email', EmailType::class, [
'constraints' => [
new NotBlank(),
new Email(),
new UniqueEntity([
'fields' => 'email'
]),
],
]);
$builder->add('password', HashedPasswordType::class, [
'password_options' => [
'constraints' => [
new NotBlank(),
new Length(['max'=>1024]),
],
],
]);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment