2015-02-22 08:30:25 +00:00
|
|
|
<?php
|
2015-05-30 11:52:26 +00:00
|
|
|
|
2015-02-22 08:30:25 +00:00
|
|
|
namespace Wallabag\CoreBundle\Form\Type;
|
|
|
|
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
2015-06-02 14:58:19 +00:00
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
2015-02-22 08:30:25 +00:00
|
|
|
use Symfony\Component\Validator\Constraints;
|
|
|
|
|
|
|
|
class NewUserType extends AbstractType
|
|
|
|
{
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
|
|
{
|
|
|
|
$builder
|
2015-04-15 14:50:20 +00:00
|
|
|
->add('username', 'text', array('required' => true))
|
2015-09-29 12:31:52 +00:00
|
|
|
->add('plainPassword', 'repeated', array(
|
|
|
|
'type' => 'password',
|
2015-02-22 08:30:25 +00:00
|
|
|
'constraints' => array(
|
|
|
|
new Constraints\Length(array(
|
|
|
|
'min' => 8,
|
|
|
|
'minMessage' => 'Password should by at least 8 chars long',
|
|
|
|
)),
|
|
|
|
new Constraints\NotBlank(),
|
|
|
|
),
|
|
|
|
))
|
2015-04-15 14:50:20 +00:00
|
|
|
->add('email', 'email')
|
2015-02-22 08:30:25 +00:00
|
|
|
->add('save', 'submit')
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2015-06-02 14:58:19 +00:00
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
2015-02-22 08:30:25 +00:00
|
|
|
{
|
|
|
|
$resolver->setDefaults(array(
|
2015-10-02 12:51:41 +00:00
|
|
|
'data_class' => 'Wallabag\UserBundle\Entity\User',
|
2015-02-22 08:30:25 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return 'new_user';
|
|
|
|
}
|
|
|
|
}
|