Dockerize Project
This commit is contained in:
commit
e679d02b41
205 changed files with 17941 additions and 0 deletions
55
src/Form/RegistrationFormType.php
Executable file
55
src/Form/RegistrationFormType.php
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
class RegistrationFormType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('username', TextType::class, [
|
||||
'attr' => [
|
||||
'class' => 'textField',
|
||||
'placeholder' => 'Enter username'
|
||||
],
|
||||
'label' => false,
|
||||
'constraints' => [
|
||||
new NotBlank(['message' => 'Please enter a username']),
|
||||
new Length([
|
||||
'min' => 3, 'max' => 64,
|
||||
'minMessage' => 'Username should be at least {{ limit }} characters',
|
||||
'maxMessage' => 'Username should be at most {{ limit }} characters',
|
||||
])
|
||||
]
|
||||
])
|
||||
->add('plainPassword', PasswordType::class, [
|
||||
'mapped' => false,
|
||||
'attr' => ['autocomplete' => 'new-password', 'class' => 'textField', 'placeholder' => 'Enter password'],
|
||||
'constraints' => [
|
||||
new NotBlank(['message' => 'Please enter a password']),
|
||||
new Length([
|
||||
'min' => 6, 'max' => 4096, 'minMessage' => 'Password should be at least {{ limit }} characters'
|
||||
]),
|
||||
],
|
||||
'label' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => User::class,
|
||||
// enable/disable CSRF protection for this form
|
||||
'csrf_protection' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue