我试图覆盖Fosuser捆绑包的更改密码形式,并且我想在密码不适合我的模式时使用AngularJS显示错误消息 我尝试将ng-pattern添加到表单构建器,但是当我使用错误的密码格式进行测试时没有任何反应。这是我的代码:
$builder->add('plainPassword', 'repeated', array(
'type' => 'password',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('attr'=>array('name' => 'first','data-ng-model'=>'pfirst',
'placeholder' => 'enter your password',
'ng-pattern' => "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[?!-/_/=:;§]).{8,20}$/")),
'second_options' => array('label' => 'confirmation','pattern' => "/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[?!-/_/=:;§]).{8,20}$/"),
'invalid_message' => 'fos_user.password.mismatch',
));