sintonia/legacy/application/forms/PasswordChange.php

52 lines
1.6 KiB
PHP
Raw Permalink Normal View History

<?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']],
]);
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 80);
2021-10-11 16:10:47 +02:00
$this->addElement('password', 'password', [
'label' => _('Password'),
'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',
],
]);
2021-10-11 16:10:47 +02:00
$this->addElement('password', 'password_confirm', [
'label' => _('Confirm new password'),
'required' => true,
2021-10-11 16:10:47 +02:00
'filters' => ['stringTrim'],
'validators' => [
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',
],
]);
2021-10-11 16:10:47 +02:00
$this->addElement('submit', 'submit', [
2015-08-07 20:22:01 +02:00
'label' => _('Save'),
'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',
],
]);
}
}