2011-12-22 01:01:29 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Form_PasswordChange extends Zend_Form
|
|
|
|
{
|
|
|
|
public function init()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->setDecorators([
|
|
|
|
['ViewScript', ['viewScript' => 'form/password-change.phtml']],
|
|
|
|
]);
|
|
|
|
|
2012-11-27 23:11:29 +01:00
|
|
|
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
|
2012-11-27 23:28:27 +01:00
|
|
|
$stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 80);
|
2012-07-11 00:55:44 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->addElement('password', 'password', [
|
2012-11-15 16:59:06 +01:00
|
|
|
'label' => _('Password'),
|
2011-12-22 01:01:29 +01:00
|
|
|
'required' => true,
|
2021-10-11 16:10:47 +02:00
|
|
|
'filters' => ['stringTrim'],
|
2022-07-07 20:01:15 +02:00
|
|
|
'validators' => [
|
|
|
|
$notEmptyValidator,
|
|
|
|
$stringLengthValidator,
|
|
|
|
],
|
2021-10-11 16:10:47 +02:00
|
|
|
'decorators' => [
|
|
|
|
'ViewHelper',
|
|
|
|
],
|
|
|
|
]);
|
2011-12-22 01:01:29 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->addElement('password', 'password_confirm', [
|
2012-11-15 16:59:06 +01:00
|
|
|
'label' => _('Confirm new password'),
|
2011-12-22 01:01:29 +01:00
|
|
|
'required' => true,
|
2021-10-11 16:10:47 +02:00
|
|
|
'filters' => ['stringTrim'],
|
|
|
|
'validators' => [
|
2011-12-22 01:01:29 +01:00
|
|
|
new Zend_Validate_Callback(function ($value, $context) {
|
|
|
|
return $value == $context['password'];
|
|
|
|
}),
|
2021-10-11 16:10:47 +02:00
|
|
|
],
|
|
|
|
'errorMessages' => [_('Password confirmation does not match your password.')],
|
|
|
|
'decorators' => [
|
|
|
|
'ViewHelper',
|
|
|
|
],
|
|
|
|
]);
|
2011-12-22 01:01:29 +01:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->addElement('submit', 'submit', [
|
2015-08-07 20:22:01 +02:00
|
|
|
'label' => _('Save'),
|
2011-12-22 01:01:29 +01:00
|
|
|
'ignore' => true,
|
2012-04-17 18:16:10 +02:00
|
|
|
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
|
2021-10-11 16:10:47 +02:00
|
|
|
'decorators' => [
|
|
|
|
'ViewHelper',
|
|
|
|
],
|
|
|
|
]);
|
2011-12-22 01:01:29 +01:00
|
|
|
}
|
|
|
|
}
|