当前位置: 首页>>代码示例>>PHP>>正文


PHP PasswordHash::checkPassword方法代码示例

本文整理汇总了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);
	}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:13,代码来源:gpg.php

示例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);
 }
开发者ID:sklww,项目名称:Cinch,代码行数:12,代码来源:User.php

示例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);
 }
开发者ID:norbyn,项目名称:alimentos,代码行数:12,代码来源:Appunto_auth.php

示例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;
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:11,代码来源:SecurityService.php

示例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;
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:26,代码来源:class.passwordhash.php

示例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);
 }
开发者ID:R-J,项目名称:vanilla,代码行数:11,代码来源:class.passwordhash.php

示例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;
 }
开发者ID:JLacoude,项目名称:Atrexus,代码行数:26,代码来源:User.php


注:本文中的PasswordHash::checkPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。