当前位置: 首页>>代码示例>>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;未经允许,请勿转载。