import v1.0.0-RC4 | 2009-05-20
This commit is contained in:
38
libs/Monkeys/Validate/PasswordConfirmation.php
Normal file
38
libs/Monkeys/Validate/PasswordConfirmation.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Monkeys_Validate_PasswordConfirmation extends Zend_Validate_Abstract
|
||||
{
|
||||
const NOT_MATCH = 'notMatch';
|
||||
|
||||
protected $_messageTemplates = array(
|
||||
self::NOT_MATCH => 'Password confirmation does not match'
|
||||
);
|
||||
|
||||
public function isValid($value, $context = null)
|
||||
{
|
||||
$value = (string) $value;
|
||||
$this->_setValue($value);
|
||||
|
||||
if (is_array($context)) {
|
||||
if (isset($context['password2'])
|
||||
&& ($value == $context['password2']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} elseif (is_string($context) && ($value == $context)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->_error(self::NOT_MATCH);
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user