Created
March 25, 2010 08:57
-
-
Save Bittarman/343333 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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