本文整理匯總了PHP中Crypt::checkHashPass方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypt::checkHashPass方法的具體用法?PHP Crypt::checkHashPass怎麽用?PHP Crypt::checkHashPass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crypt
的用法示例。
在下文中一共展示了Crypt::checkHashPass方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkUserMPass
/**
* Comprueba la clave maestra del usuario.
*
* @param User $User
* @return bool
*/
public static function checkUserMPass(User $User)
{
$userMPass = $User->getUserMPass(true);
if ($userMPass === false) {
return false;
}
$configHashMPass = ConfigDB::getValue('masterPwd');
if ($configHashMPass === false || is_null($configHashMPass)) {
return false;
}
// Comprobamos el hash de la clave del usuario con la guardada
return Crypt::checkHashPass($userMPass, $configHashMPass, true);
}
示例2: checkTempMasterPass
/**
* Comprueba si la clave temporal es válida
*
* @param string $pass clave a comprobar
* @return bool
*/
public static function checkTempMasterPass($pass)
{
$passTime = ConfigDB::getValue('tempmaster_passtime');
$passMaxTime = ConfigDB::getValue('tempmaster_maxtime');
$attempts = ConfigDB::getValue('tempmaster_attempts');
// Comprobar si el tiempo de validez se ha superado
if ($passTime !== false && time() - $passTime > $passMaxTime || $attempts >= 5) {
ConfigDB::setCacheConfigValue('tempmaster_pass', '');
ConfigDB::setCacheConfigValue('tempmaster_passiv', '');
ConfigDB::setCacheConfigValue('tempmaster_passhash', '');
ConfigDB::writeConfig();
return false;
}
Crypt::checkHashPass($pass, ConfigDB::getValue('tempmaster_passhash'));
$isValid = Crypt::checkHashPass($pass, ConfigDB::getValue('tempmaster_passhash'));
if (!$isValid) {
ConfigDB::setValue('tempmaster_attempts', $attempts + 1, false);
}
return $isValid;
}
示例3: updateUserMPass
/**
* Actualizar la clave maestra del usuario en la BBDD.
*
* @param string $masterPwd con la clave maestra
* @return bool
*/
public function updateUserMPass($masterPwd)
{
$configHashMPass = ConfigDB::getValue('masterPwd');
if ($configHashMPass === false) {
return false;
}
if (is_null($configHashMPass)) {
$configHashMPass = Crypt::mkHashPassword($masterPwd);
ConfigDB::setValue('masterPwd', $configHashMPass);
}
if (Crypt::checkHashPass($masterPwd, $configHashMPass, true)) {
$cryptMPass = Crypt::mkCustomMPassEncrypt(self::getCypherPass(), $masterPwd);
if (!$cryptMPass) {
return false;
}
} else {
return false;
}
$query = 'UPDATE usrData SET ' . 'user_mPass = :mPass,' . 'user_mIV = :mIV,' . 'user_lastUpdateMPass = UNIX_TIMESTAMP() ' . 'WHERE user_id = :id LIMIT 1';
$data['mPass'] = $cryptMPass[0];
$data['mIV'] = $cryptMPass[1];
$data['id'] = $this->_userId;
return DB::getQuery($query, __FUNCTION__, $data);
}