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


PHP Hashing\BcryptHasher類代碼示例

本文整理匯總了PHP中Illuminate\Hashing\BcryptHasher的典型用法代碼示例。如果您正苦於以下問題:PHP BcryptHasher類的具體用法?PHP BcryptHasher怎麽用?PHP BcryptHasher使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: unlock

 /**
  * Unlocks a batch by checking the specified
  * password against the batch password.
  *
  * @param BatchUnlockRequest $request
  *
  * @return bool
  */
 public function unlock(BatchUnlockRequest $request)
 {
     $hasher = new BcryptHasher();
     if ($hasher->check($request->input('password'), $this->password)) {
         // Store the UUID in the users session so they can have
         // access to it for as long as the session exists
         $request->session()->put($this->uuid, $this->uuid);
         return true;
     }
     return false;
 }
開發者ID:stevebauman,項目名稱:quickly-share-it,代碼行數:19,代碼來源:Batch.php

示例2: setRounds

 /**
  * Set the default password work factor.
  *
  * @param int $rounds
  * @return $this 
  * @static 
  */
 public static function setRounds($rounds)
 {
     return \Illuminate\Hashing\BcryptHasher::setRounds($rounds);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:11,代碼來源:_ide_helper.php

示例3: needsRehash

 /**
  * Check if the given hash has been hashed using the given options.
  *
  * @param string $hashedValue
  * @param array $options
  * @return bool 
  * @static 
  */
 public static function needsRehash($hashedValue, $options = array())
 {
     return \Illuminate\Hashing\BcryptHasher::needsRehash($hashedValue, $options);
 }
開發者ID:nmkr,項目名稱:basic-starter,代碼行數:12,代碼來源:_ide_helper.php

示例4: checkPin

 /**
  * Checks the specified pin against the current password folder pin.
  *
  * @param string $pin
  *
  * @return bool
  */
 public function checkPin($pin)
 {
     $hasher = new BcryptHasher();
     return $hasher->check($pin, $this->pin);
 }
開發者ID:stevebauman,項目名稱:ithub,代碼行數:12,代碼來源:PasswordFolder.php

示例5: hashHashable

 /**
  * Hash any hashable attributes
  *
  * @return null
  */
 private function hashHashable()
 {
     $hasher = new BcryptHasher();
     $filtered = array_filter($this->attributes);
     foreach ($filtered as $key => $value) {
         if (in_array($key, $this->hashable) && $value != $this->getOriginal($key)) {
             $this->attributes[$key] = $hasher->make($value);
         }
     }
 }
開發者ID:lakedawson,項目名稱:vocal,代碼行數:15,代碼來源:Vocal.php

示例6: getAuthPassword

 public function getAuthPassword()
 {
     $hasher = new BcryptHasher();
     return $hasher->make($this->password);
 }
開發者ID:brunomartins-com,項目名稱:espacofarmaceutico,代碼行數:5,代碼來源:User.php

示例7: changePassword

 public function changePassword()
 {
     $adminId = Input::get("adminId");
     $username = Input::get("username");
     $oldPassword = Input::get("oldPassword");
     $newPassword = Input::get("newPassword");
     $newPasswordConfirm = Input::get("newPasswordConfirm");
     $hasher = new BcryptHasher();
     if (Auth::attempt(array('username' => $username, 'password' => $oldPassword))) {
         $result = Admin::where("admin_id", "=", $adminId)->update(["password" => $hasher->make($newPassword)]);
         if ($result == 0) {
             return Response::json(array('errCode' => 1, 'errMsg' => "[修改失敗]數據庫錯誤"));
         }
     } else {
         return Response::json(array('errCode' => 1, 'errMsg' => "[修改失敗]原密碼錯誤"));
     }
     return Response::json(array('errCode' => 0));
 }
開發者ID:Jv-Juven,項目名稱:carService,代碼行數:18,代碼來源:AdminController.php

示例8: postPassword

 /**
  * @param Request      $request
  * @param BcryptHasher $hasher
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postPassword(Request $request, BcryptHasher $hasher)
 {
     $this->failedValidationRedirect = route('account.password');
     $this->validate($request, ['password1' => 'required|min:6', 'password' => 'required']);
     if ($this->guard->getProvider()->validateCredentials($this->guard->user(), $request->only('password'))) {
         // Don't save the password in plaintext!
         ConfirmationManager::send('password', $this->guard->user(), 'account.password.confirm', $hasher->make($request->get('password1')));
         return redirect()->route('account.profile')->withSuccess(trans('account.confirm'));
     }
     return redirect()->route('account.password')->withInput($request->only('password1'))->withErrors(['password1' => trans('member.invalidCredentials')]);
 }
開發者ID:Adamzynoni,項目名稱:mybb2,代碼行數:17,代碼來源:AccountController.php

示例9: check

 /**
  * @param $value
  * @return bool
  */
 public function check($value)
 {
     $store = $this->session->get('captcha');
     if ($this->sensitive) {
         $value = $this->str->lower($value);
         $store = $this->str->lower($store);
     }
     return $this->hasher->check($value, $store);
 }
開發者ID:iwillhappy1314,項目名稱:laravel-admin,代碼行數:13,代碼來源:Captcha.php

示例10: updateSettings

 public function updateSettings(Request $request, Hash $hash)
 {
     $user = $request->user();
     $rules = ['old_password' => 'required|min:8', 'password' => 'required|confirmed|min:8'];
     $validator = app('validation')->make($request->all(), $rules);
     if ($validator->fails()) {
         $request->session->add(['errors' => $validator->errors()->all()]);
         return app('twig')->render('user/settings.htm', ['oldInputs' => $request->all()]);
     }
     if (!$hash->check($request->input('old_password'), $user->password)) {
         $request->session->add(['errors' => ['Old password incorrect.']]);
         return app('twig')->render('user/settings.htm', ['oldInputs' => $request->all()]);
     }
     $user->password = $hash->make($request->input('old_password'));
     $user->save();
     $request->session->add(['success' => 'settings updated successfuly.']);
     return app('twig')->render('user/settings.htm');
 }
開發者ID:lihuibin,項目名稱:notejam_blink,代碼行數:18,代碼來源:UserController.php

示例11: check

 /**
  *
  * @param $value
  * @return bool
  */
 public function check($value)
 {
     $store = $this->session->get('captcha' . (Input::has('captcha_id') ? '_' . Input::get('captcha_id') : ''));
     if ($this->sensitive) {
         $value = $this->str->lower($value);
         $store = $this->str->lower($store);
     }
     return $this->hasher->check($value, $store);
 }
開發者ID:votong,項目名稱:captcha,代碼行數:14,代碼來源:Captcha.php

示例12: check

 /**
  * Captcha check
  *
  * @param $value
  * @return bool
  */
 public function check($value)
 {
     if (!$this->session->has('captcha')) {
         return false;
     }
     $key = $this->session->get('captcha.key');
     if (!$this->session->get('captcha.sensitive')) {
         $value = $this->str->lower($value);
     }
     $this->session->remove('captcha');
     return $this->hasher->check($value, $key);
 }
開發者ID:diandianxiyu,項目名稱:ApiTesting,代碼行數:18,代碼來源:Captcha.php

示例13: hash

 /**
  * Create a new HashedPassword
  *
  * @param Password $password
  * @return HashedPassword
  */
 public function hash(Password $password)
 {
     return new HashedPassword($this->hasher->make($password->toString()));
 }
開發者ID:kfuchs,項目名稱:cribbb,代碼行數:10,代碼來源:BcryptHashingService.php

示例14: check

 /**
  * Check if password matches
  *
  * @param Password $password
  * @param HashedPassword $hashedPassword
  * @return boolean
  */
 public function check(Password $password, HashedPassword $hashedPassword)
 {
     return $this->hasher->check($password->toString(), $hashedPassword->toString());
 }
開發者ID:Evyy,項目名稱:cffs-api,代碼行數:11,代碼來源:BcryptHashingService.php

示例15: hash

 /**
  * Create a new HashedPassword
  *
  * @param Password $password
  * @return HashedPassword
  */
 public function hash(Password $password)
 {
     return new HashedPassword($this->hasher->make((string) $password));
 }
開發者ID:snb4crazy,項目名稱:cribbb,代碼行數:10,代碼來源:BcryptHashingService.php


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