当使用更改密码在Zend中,我想检查旧密码和新的password.Both不应该是same.Is在Zend中有任何选项来检查这两个。
提前谢谢。
发布于 2012-08-14 14:31:35
在My下创建一个库,并使用以下内容:
class My_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['password_confirm'])
&& ($value == $context['password_confirm']))
{
return true;
}
} elseif (is_string($context) && ($value == $context)) {
return true;
}
$this->_error(self::NOT_MATCH);
return false;
}
}More Information at the : Zend Manual向下滚动到或查找:
注释:验证上下文
在源页面上。代码就在它的下方,解释也是如此。
希望它能有所帮助!:)
https://stackoverflow.com/questions/11946703
复制相似问题