本文整理汇总了PHP中PasswordHash::checkPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP PasswordHash::checkPassword方法的具体用法?PHP PasswordHash::checkPassword怎么用?PHP PasswordHash::checkPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PasswordHash
的用法示例。
在下文中一共展示了PasswordHash::checkPassword方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPassword
/**
* Check that the supplied password or key is valid for this user.
*
* @param string $password The password to verify
* @return boolean
*/
public function checkPassword($password){
$hasher = new \PasswordHash(datastore::HASH_ITERATIONS);
// The password for datastores are stored in the datastore.
$currentpass = $this->_usermodel->get('password');
return $hasher->checkPassword($password, $currentpass);
}
示例2: validatePassword
/**
* Encrypt user's password using Blowfish algorithm and bcrypt
* @param $password
* @param $db_pass
* @access public
* @return boolean
*/
public function validatePassword($password, $db_pass)
{
$check_pass = new PasswordHash(8, false);
return $check_pass->checkPassword($password, $db_pass);
}
示例3: checkPassword
/**
* compare a password to a hashed password.
*
* @param string
* @param string
* @return boolean
*/
public function checkPassword($password, $hash)
{
$hasher = new PasswordHash($this->CI->config->item('hash_logarithm', 'appunto-auth/appunto_auth'), $this->CI->config->item('hash_use_portable', 'appunto-auth/appunto_auth'));
return $hasher->checkPassword($password, $hash);
}
示例4: checkString
/**
* @param $string
* @param $storedHash
* @return bool
*/
public function checkString($string, $storedHash)
{
$hasher = new \PasswordHash($this->_iterationCount, false);
$check = $hasher->checkPassword($string, $storedHash);
return $check;
}
示例5: checkVanilla
/**
* Check a Vanilla hash.
*
* @param $Password
* @param $StoredHash
* @return bool
*/
function checkVanilla($Password, $StoredHash)
{
$this->Weak = false;
if (!isset($StoredHash[0])) {
return false;
}
if ($StoredHash[0] === '_' || $StoredHash[0] === '$') {
$Result = parent::checkPassword($Password, $StoredHash);
// Check to see if this password should be rehashed to crypt-blowfish.
if (!$this->portable_hashes && CRYPT_BLOWFISH == 1 && substr($StoredHash, 0, 3) === '$P$') {
$this->Weak = true;
}
return $Result;
} elseif ($Password && $StoredHash !== '*' && ($Password === $StoredHash || md5($Password) === $StoredHash)) {
$this->Weak = true;
return true;
}
return false;
}
示例6: checkPhpass
/**
* Check a password using Phpass' hash.
*
* @param string $Password The plaintext password to check.
* @param string $StoredHash The password hash stored in the database.
* @return bool Returns **true** if the password matches the hash or **false** if it doesn't.
*/
public function checkPhpass($Password, $StoredHash)
{
return parent::checkPassword($Password, $StoredHash);
}
示例7: changeEmail
/**
* Change user's email
*
* @param string $currentPassword Current user password to check if it can be changed
* @param string $newEmail New Email
*/
public function changeEmail($currentPassword, $newEmail)
{
$this->_db->beginTransaction();
try {
$userInfos = $this->_db->fetchFirstRequest('getUserPassword', array(':id' => $this->_userInfos['ID']));
if (!empty($userInfos)) {
$hasher = new PasswordHash(8, false);
if ($hasher->checkPassword($currentPassword, $userInfos['password'])) {
$this->_db->executeRequest('changeUserEmail', array(':email' => $newEmail, ':id' => $this->_userInfos['ID']));
} else {
$this->_messenger->add('error', $this->_lang->get('wrongPassword'));
}
}
} catch (Exception $e) {
$this->_db->rollBack();
throw $e;
}
$this->_db->commit();
return true;
}