1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Smart\AuthenticationBundle\Security\Form\Type; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Form\AbstractType; |
6
|
|
|
use Symfony\Component\Form\Extension\Core\Type\EmailType; |
7
|
|
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType; |
8
|
|
|
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; |
9
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
10
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @author Mathieu Ducrot <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class UserProfileType extends AbstractType |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @inheritdoc |
19
|
|
|
*/ |
20
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void |
21
|
|
|
{ |
22
|
|
|
$builder |
23
|
|
|
->add('email', EmailType::class, [ |
24
|
|
|
'label' => 'form.label_email', |
25
|
|
|
'attr' => ['autocomplete' => 'off'], |
26
|
|
|
]) |
27
|
|
|
->add('firstName', null, [ |
28
|
|
|
'label' => 'form.label_first_name', |
29
|
|
|
'attr' => ['autocomplete' => 'off'], |
30
|
|
|
]) |
31
|
|
|
->add('lastName', null, [ |
32
|
|
|
'label' => 'form.label_last_name', |
33
|
|
|
'attr' => ['autocomplete' => 'off'], |
34
|
|
|
]) |
35
|
|
|
->add( |
36
|
|
|
'plainPassword', |
37
|
|
|
RepeatedType::class, |
38
|
|
|
[ |
39
|
|
|
'type' => PasswordType::class, |
40
|
|
|
'required' => false, |
41
|
|
|
'first_options' => ['label' => 'form.label_password'], |
42
|
|
|
'second_options' => ['label' => 'form.label_password_confirmation'], |
43
|
|
|
'translation_domain' => $options['translation_domain'], |
44
|
|
|
'invalid_message' => 'reset_password.password_must_match', |
45
|
|
|
'attr' => ['autocomplete' => 'off'], |
46
|
|
|
] |
47
|
|
|
); |
48
|
|
|
; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @inheritdoc |
53
|
|
|
*/ |
54
|
|
|
public function configureOptions(OptionsResolver $resolver): void |
55
|
|
|
{ |
56
|
|
|
$resolver |
57
|
|
|
->setDefaults([ |
58
|
|
|
'translation_domain' => 'admin' |
59
|
|
|
]) |
60
|
|
|
; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|