當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Password::equals方法代碼示例

本文整理匯總了PHP中Password::equals方法的典型用法代碼示例。如果您正苦於以下問題:PHP Password::equals方法的具體用法?PHP Password::equals怎麽用?PHP Password::equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Password的用法示例。


在下文中一共展示了Password::equals方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: should_test_equality

 /** @test */
 public function should_test_equality()
 {
     $one = new Password('qwertyuiop');
     $two = new Password('qwertyuiop');
     $three = new Password('asdfghjkl');
     $this->assertTrue($one->equals($two));
     $this->assertFalse($one->equals($three));
 }
開發者ID:snb4crazy,項目名稱:cribbb,代碼行數:9,代碼來源:PasswordTest.php

示例2: checkTemporaryPassword

 /**
  * Check if the given clear-text password matches the temporary password
  * sent by e-mail for password reset operations.
  *
  * @param string $plaintext
  *
  * @return bool True if matches, false otherwise
  */
 public function checkTemporaryPassword($plaintext)
 {
     global $wgNewPasswordExpiry;
     $this->load();
     $this->loadPasswords();
     if ($this->mNewpassword->equals($plaintext)) {
         if (is_null($this->mNewpassTime)) {
             return true;
         }
         $expiry = wfTimestamp(TS_UNIX, $this->mNewpassTime) + $wgNewPasswordExpiry;
         return time() < $expiry;
     } else {
         return false;
     }
 }
開發者ID:jpena88,項目名稱:mediawiki-dokku-deploy,代碼行數:23,代碼來源:User.php

示例3: matchHash

 /**
  * @param string $plaintext User-provided password plaintext.
  * @param Password $password Password to check against
  *
  * @return Status
  */
 protected function matchHash($plaintext, Password $password)
 {
     $matched = false;
     if ($password->equals($plaintext)) {
         $matched = true;
     } elseif (!$password instanceof Pbkdf2Password && function_exists('iconv')) {
         // Some wikis were converted from ISO 8859-1 to UTF-8;
         // retained hashes may contain non-latin chars.
         $latin1 = iconv('UTF-8', 'WINDOWS-1252//TRANSLIT', $plaintext);
         if ($password->equals($latin1)) {
             $matched = true;
         }
     }
     if ($matched) {
         return Status::newGood($password);
     } else {
         return Status::newFatal('bad');
     }
 }
開發者ID:NDKilla,項目名稱:mediawiki-extensions-CentralAuth,代碼行數:25,代碼來源:CentralAuthUser.php


注:本文中的Password::equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。