Skip to content

Instantly share code, notes, and snippets.

@Bittarman
Created March 25, 2010 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bittarman/343333 to your computer and use it in GitHub Desktop.
Save Bittarman/343333 to your computer and use it in GitHub Desktop.
<?php
/*
* Copyright 2009 Lupimedia
* All rights reserved
*/
class Lupi_Validate_Password extends Zend_Validate_Abstract
{
const NO_MATCH = 'noMatch';
protected $_messageTemplates = array(
self::NO_MATCH => 'Passwords do not match',
);
protected $_element = null;
public function getElement()
{
if (null === $this->_element) {
$this->_element = 'password';
}
return $this->_element;
}
public function setElement($element)
{
$this->_element = (string) $element;
}
public function isValid($value, $context = null)
{
$this->_setValue($value);
if ($value !== $context[$this->getElement()]) {
$this->_error(self::NO_MATCH);
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment