Updating logged in user (email, name, etc ..)

This commit is contained in:
Jeremy
2015-02-17 22:45:20 +01:00
parent d9085c63e3
commit c0d9eba07f
7 changed files with 185 additions and 20 deletions

View File

@ -3,7 +3,6 @@ namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
use Symfony\Component\Validator\Constraints;
@ -23,11 +22,11 @@ class ChangePasswordType extends AbstractType
'second_options' => array('label' => 'Repeat new password'),
'constraints' => array(
new Constraints\Length(array(
'min' => 6,
'minMessage' => 'Password should by at least 6 chars long'
'min' => 8,
'minMessage' => 'Password should by at least 6 chars long',
)),
new Constraints\NotBlank()
)
new Constraints\NotBlank(),
),
))
->add('save', 'submit')
;

View File

@ -21,7 +21,7 @@ class ConfigType extends AbstractType
'solarized_dark' => 'Solarized Dark',
),
))
->add('items_per_page')
->add('items_per_page', 'text')
->add('language')
->add('save', 'submit')
;

View File

@ -0,0 +1,31 @@
<?php
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class UserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('username', 'text')
->add('name', 'text')
->add('email', 'text')
->add('save', 'submit')
;
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Wallabag\CoreBundle\Entity\User',
));
}
public function getName()
{
return 'user';
}
}