aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Form
diff options
context:
space:
mode:
authorJeremy <jeremy.benoist@gmail.com>2015-02-17 22:45:20 +0100
committerJeremy <jeremy.benoist@gmail.com>2015-02-17 22:45:20 +0100
commitc0d9eba07f40a52bdfcfca3e7a926163b17d83ab (patch)
treeb80e1e1a4dc51519b28ea995e411231d35135763 /src/Wallabag/CoreBundle/Form
parentd9085c63e35bb708f560722fff5f4f5ad322c27b (diff)
downloadwallabag-c0d9eba07f40a52bdfcfca3e7a926163b17d83ab.tar.gz
wallabag-c0d9eba07f40a52bdfcfca3e7a926163b17d83ab.tar.zst
wallabag-c0d9eba07f40a52bdfcfca3e7a926163b17d83ab.zip
Updating logged in user (email, name, etc ..)
Diffstat (limited to 'src/Wallabag/CoreBundle/Form')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php9
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php2
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/UserType.php31
3 files changed, 36 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php
index 8bf4ca1e..de0ad537 100644
--- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php
@@ -3,7 +3,6 @@ namespace Wallabag\CoreBundle\Form\Type;
3 3
4use Symfony\Component\Form\AbstractType; 4use Symfony\Component\Form\AbstractType;
5use Symfony\Component\Form\FormBuilderInterface; 5use Symfony\Component\Form\FormBuilderInterface;
6use Symfony\Component\OptionsResolver\OptionsResolverInterface;
7use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; 6use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
8use Symfony\Component\Validator\Constraints; 7use Symfony\Component\Validator\Constraints;
9 8
@@ -23,11 +22,11 @@ class ChangePasswordType extends AbstractType
23 'second_options' => array('label' => 'Repeat new password'), 22 'second_options' => array('label' => 'Repeat new password'),
24 'constraints' => array( 23 'constraints' => array(
25 new Constraints\Length(array( 24 new Constraints\Length(array(
26 'min' => 6, 25 'min' => 8,
27 'minMessage' => 'Password should by at least 6 chars long' 26 'minMessage' => 'Password should by at least 6 chars long',
28 )), 27 )),
29 new Constraints\NotBlank() 28 new Constraints\NotBlank(),
30 ) 29 ),
31 )) 30 ))
32 ->add('save', 'submit') 31 ->add('save', 'submit')
33 ; 32 ;
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
index 74e2a6f1..a1e0ce47 100644
--- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
@@ -21,7 +21,7 @@ class ConfigType extends AbstractType
21 'solarized_dark' => 'Solarized Dark', 21 'solarized_dark' => 'Solarized Dark',
22 ), 22 ),
23 )) 23 ))
24 ->add('items_per_page') 24 ->add('items_per_page', 'text')
25 ->add('language') 25 ->add('language')
26 ->add('save', 'submit') 26 ->add('save', 'submit')
27 ; 27 ;
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserType.php b/src/Wallabag/CoreBundle/Form/Type/UserType.php
new file mode 100644
index 00000000..b479a0b5
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Form/Type/UserType.php
@@ -0,0 +1,31 @@
1<?php
2namespace Wallabag\CoreBundle\Form\Type;
3
4use Symfony\Component\Form\AbstractType;
5use Symfony\Component\Form\FormBuilderInterface;
6use Symfony\Component\OptionsResolver\OptionsResolverInterface;
7
8class UserType extends AbstractType
9{
10 public function buildForm(FormBuilderInterface $builder, array $options)
11 {
12 $builder
13 ->add('username', 'text')
14 ->add('name', 'text')
15 ->add('email', 'text')
16 ->add('save', 'submit')
17 ;
18 }
19
20 public function setDefaultOptions(OptionsResolverInterface $resolver)
21 {
22 $resolver->setDefaults(array(
23 'data_class' => 'Wallabag\CoreBundle\Entity\User',
24 ));
25 }
26
27 public function getName()
28 {
29 return 'user';
30 }
31}