mirror of
https://github.com/wallabag/wallabag.git
synced 2024-06-26 17:10:34 +00:00
41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
|
<?php
|
||
|
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;
|
||
|
|
||
|
class ChangePasswordType extends AbstractType
|
||
|
{
|
||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||
|
{
|
||
|
$builder
|
||
|
->add('old_password', 'password', array(
|
||
|
'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')),
|
||
|
))
|
||
|
->add('new_password', 'repeated', array(
|
||
|
'type' => 'password',
|
||
|
'invalid_message' => 'The password fields must match.',
|
||
|
'required' => true,
|
||
|
'first_options' => array('label' => 'New password'),
|
||
|
'second_options' => array('label' => 'Repeat new password'),
|
||
|
'constraints' => array(
|
||
|
new Constraints\Length(array(
|
||
|
'min' => 6,
|
||
|
'minMessage' => 'Password should by at least 6 chars long'
|
||
|
)),
|
||
|
new Constraints\NotBlank()
|
||
|
)
|
||
|
))
|
||
|
->add('save', 'submit')
|
||
|
;
|
||
|
}
|
||
|
|
||
|
public function getName()
|
||
|
{
|
||
|
return 'change_passwd';
|
||
|
}
|
||
|
}
|