2019-07-17 20:16:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2019-07-17 20:31:04 +00:00
|
|
|
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
2019-07-17 20:16:19 +00:00
|
|
|
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
|
|
|
* @author Keyboard Monkeys Ltd.
|
|
|
|
* @since CommunityID 0.9
|
|
|
|
* @package CommunityID
|
|
|
|
* @packager Keyboard Monkeys
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
class Users_Form_ChangePassword extends Zend_Form
|
|
|
|
{
|
2019-07-17 20:31:04 +00:00
|
|
|
private $_username;
|
|
|
|
|
|
|
|
public function __construct($options = null, $username = null)
|
|
|
|
{
|
|
|
|
$this->_username = $username;
|
|
|
|
parent::__construct($options);
|
|
|
|
}
|
|
|
|
|
2019-07-17 20:16:19 +00:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$password1 = new Monkeys_Form_Element_Password('password1');
|
|
|
|
translate('Enter password');
|
2019-07-17 20:31:04 +00:00
|
|
|
$passwordValidator = new Monkeys_Validate_Password($this->_username);
|
2019-07-17 20:16:19 +00:00
|
|
|
$password1->setLabel('Enter password')
|
|
|
|
->setRequired(true)
|
2019-07-17 20:31:04 +00:00
|
|
|
->addValidator(new Monkeys_Validate_PasswordConfirmation())
|
|
|
|
->addValidator($passwordValidator);
|
|
|
|
|
|
|
|
if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) {
|
|
|
|
$password1->setDescription($restrictions);
|
|
|
|
}
|
2019-07-17 20:16:19 +00:00
|
|
|
|
|
|
|
$password2 = new Monkeys_Form_Element_Password('password2');
|
|
|
|
translate('Enter password again');
|
|
|
|
$password2->setLabel('Enter password again')
|
|
|
|
->setRequired(true);
|
|
|
|
|
|
|
|
$this->addElements(array($password1, $password2));
|
|
|
|
}
|
|
|
|
}
|