diff options
author | Jeremy <jeremy.benoist@gmail.com> | 2015-02-22 09:30:25 +0100 |
---|---|---|
committer | Jeremy <jeremy.benoist@gmail.com> | 2015-02-22 09:30:25 +0100 |
commit | e4977b8a866f84f65f08c55c050a62f40170fdbf (patch) | |
tree | f42886d6691d18ad8860b3ee2565f857204c7857 /src/Wallabag/CoreBundle/Form/Type | |
parent | c0d9eba07f40a52bdfcfca3e7a926163b17d83ab (diff) | |
download | wallabag-e4977b8a866f84f65f08c55c050a62f40170fdbf.tar.gz wallabag-e4977b8a866f84f65f08c55c050a62f40170fdbf.tar.zst wallabag-e4977b8a866f84f65f08c55c050a62f40170fdbf.zip |
Adding new user
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php | 2 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/NewUserType.php | 40 |
2 files changed, 41 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php index de0ad537..e141789f 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php | |||
@@ -23,7 +23,7 @@ class ChangePasswordType extends AbstractType | |||
23 | 'constraints' => array( | 23 | 'constraints' => array( |
24 | new Constraints\Length(array( | 24 | new Constraints\Length(array( |
25 | 'min' => 8, | 25 | 'min' => 8, |
26 | 'minMessage' => 'Password should by at least 6 chars long', | 26 | 'minMessage' => 'Password should by at least 8 chars long', |
27 | )), | 27 | )), |
28 | new Constraints\NotBlank(), | 28 | new Constraints\NotBlank(), |
29 | ), | 29 | ), |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php new file mode 100644 index 00000000..313a9aae --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php | |||
@@ -0,0 +1,40 @@ | |||
1 | <?php | ||
2 | namespace Wallabag\CoreBundle\Form\Type; | ||
3 | |||
4 | use Symfony\Component\Form\AbstractType; | ||
5 | use Symfony\Component\Form\FormBuilderInterface; | ||
6 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
7 | use Symfony\Component\Validator\Constraints; | ||
8 | |||
9 | class NewUserType extends AbstractType | ||
10 | { | ||
11 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
12 | { | ||
13 | $builder | ||
14 | ->add('username', 'text') | ||
15 | ->add('password', 'password', array( | ||
16 | 'constraints' => array( | ||
17 | new Constraints\Length(array( | ||
18 | 'min' => 8, | ||
19 | 'minMessage' => 'Password should by at least 8 chars long', | ||
20 | )), | ||
21 | new Constraints\NotBlank(), | ||
22 | ), | ||
23 | )) | ||
24 | ->add('email', 'text') | ||
25 | ->add('save', 'submit') | ||
26 | ; | ||
27 | } | ||
28 | |||
29 | public function setDefaultOptions(OptionsResolverInterface $resolver) | ||
30 | { | ||
31 | $resolver->setDefaults(array( | ||
32 | 'data_class' => 'Wallabag\CoreBundle\Entity\User', | ||
33 | )); | ||
34 | } | ||
35 | |||
36 | public function getName() | ||
37 | { | ||
38 | return 'new_user'; | ||
39 | } | ||
40 | } | ||