My Password in DB encrypt with MD5, how can i check if a specific record exists with MD5 and using \\Zend\\Validator\\Db\\RecordExists?
'validators' => array(
array(
'name' => '\Zend\Validator\Db\RecordExists',
'options' => array(
'table' => 'users',
'field' => 'password',
'adapter' => $this->dbAdapter,
'messages' => array(
\Zend\Validator\Db\RecordExists::ERROR_NO_RECORD_FOUND=> 'Password not match',
),
),
),
According to zend documentation you could try it like this :
//Validator declaration but the way you used it should work too.
$validator = new Zend_Validate_Db_RecordExists(
array(
'table' => 'users',
'field' => 'password',
'adapter' => $this->dbAdapter,
)
);
if ($validator->isValid($recordToCheck)) {
// Password exists
} else {
// Password does not exists and we display the error message
foreach ($validator->getMessages() as $message) {
echo 'Password not match';
}
}
Hope it'll help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.