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/NewUserType.php | |
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/NewUserType.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/NewUserType.php | 40 |
1 files changed, 40 insertions, 0 deletions
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 | } | ||