Skip to content

Instantly share code, notes, and snippets.

@kirkegaard
Created April 6, 2010 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kirkegaard/357404 to your computer and use it in GitHub Desktop.
Save kirkegaard/357404 to your computer and use it in GitHub Desktop.
<?php
class App_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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment