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


PHP Hasher::check方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Hashing\Hasher::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Hasher::check方法的具体用法?PHP Hasher::check怎么用?PHP Hasher::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Hashing\Hasher的用法示例。


在下文中一共展示了Hasher::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 public function fire(array $data)
 {
     $this->validator->setScenario('login')->validate($data);
     $user = $this->user->where('email', $data['email'])->first();
     if (!$this->hasher->check($data['password'], $user->password)) {
         throw new LoginFailedException();
     }
     return $user;
 }
开发者ID:tajrish,项目名称:api,代码行数:9,代码来源:LoginService.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $post = $this->post->bySlug($request->segment(2));
     if ($post->visibility_id == 2) {
         if (!$this->hash->check(Input::get('password'), $post->password)) {
             return redirect()->route('blog.askPassword', [$post->slug])->with('wrong_password', 'Please provide a valid password to view this post');
         }
     }
     return $next($request);
 }
开发者ID:raccoonsoftware,项目名称:Blogify,代码行数:17,代码来源:ProtectedPost.php

示例3: verify

 /**
  * 비회원 작성 글 인증 확인
  *
  * @param ItemEntity $item       board item entity
  * @param string     $email      email
  * @param string     $certifyKey 인증 암호
  * @return bool
  */
 public function verify(ItemEntity $item, $email, $certifyKey)
 {
     if ($email != $item->email) {
         return false;
     }
     return $this->hasher->check($certifyKey, $item->certifyKey);
 }
开发者ID:khongchi,项目名称:plugin-board,代码行数:15,代码来源:IdentifyManager.php

示例4: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  array  $credentials
  * @return bool
  */
 public function validateCredentials(UserContract $user, array $credentials)
 {
     $credentialsValidated = false;
     // If the user is set AND, either of auth_type 'internal' or with
     // auth_type unset or null, then validate against the stored
     // password hash. Otherwise if the LDAP authentication
     // method is enabled, try it.
     if (isset($user) && (isset($user->auth_type) && $this->ldapConfig['label_internal'] === $user->auth_type || !isset($user->auth_type))) {
         $plain = $credentials['password'];
         $credentialsValidated = $this->hasher->check($plain, $user->getAuthPassword());
     } else {
         if ($this->ldapConfig['enabled'] && $this->ldapConfig['label_ldap'] === $user->auth_type) {
             // Validate credentials against LDAP/AD server.
             $credentialsValidated = $this->validateLDAPCredentials($credentials);
             // If validated and config set to resync group membership on login.
             if ($credentialsValidated && $this->ldapConfig['resync_on_login']) {
                 // First, revoke membership to all groups marked to 'resync_on_login'.
                 $this->revokeMembership($user);
                 // Then replicate group membership.
                 $this->replicateMembershipFromLDAP($user);
             }
         }
     }
     return $credentialsValidated;
 }
开发者ID:syardumi,项目名称:my-eloquent-ldap,代码行数:32,代码来源:EloquentLDAPUserProvider.php

示例5: verify

 /**
  * 비회원 작성 글 인증 확인
  *
  * @param Board  $board      board model
  * @param string $email      email
  * @param string $certifyKey 인증 암호
  * @return bool
  */
 public function verify(Board $board, $email, $certifyKey)
 {
     if ($email != $board->email) {
         return false;
     }
     return $this->hasher->check($certifyKey, $board->certifyKey);
 }
开发者ID:xpressengine,项目名称:plugin-board,代码行数:15,代码来源:IdentifyManager.php

示例6: changePassword

 public function changePassword(ChangePasswordRequest $request, Auth $auth, Hasher $hash)
 {
     $user = $auth->user();
     if ($hash->check($request->password, $user->password) == false) {
         return redirect('changePassword')->withErrors('Senha atual incorreta.');
     }
     $user->password = $hash->make($request->new_password);
     $user->save();
     return redirect('/');
 }
开发者ID:natanaelphp,项目名称:Dividas2.0,代码行数:10,代码来源:ChangePasswordController.php

示例7: delete

 /**
  * Delete account
  *
  * @param User $user
  * @param array $data
  * @return bool
  */
 public function delete(User $user, array $data)
 {
     if (!$this->hasher->check($data['password'], $user->password)) {
         return false;
     }
     if ($this->userRepo->delete($user)) {
         event(new UserWasDeleted($user));
         return true;
     }
     return false;
 }
开发者ID:vjaykoogu,项目名称:smile-media-laravel,代码行数:18,代码来源:UserService.php

示例8: check

 /**
  * Check the given plain value against a hash.
  *
  * @param string $value
  * @param string $hashedValue
  * @param array $options
  *
  * @return bool
  */
 public function check($value, $hashedValue, array $options = [])
 {
     // First, we are optimistic and try to use the target hasher.
     if ($this->targetHasher->check($value, $hashedValue, $options)) {
         return true;
     }
     // Otherwise, we attempt to check if it passes any supported hasher.
     $match = false;
     Std::each(function (Hasher $hasher) use($value, $hashedValue, $options, &$match) {
         if ($hasher->check($value, $hashedValue, $options)) {
             $match = true;
         }
     }, $this->supportedHashers);
     return $match;
 }
开发者ID:MarkVaughn,项目名称:illuminated,代码行数:24,代码来源:AggregatedHasher.php

示例9: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     $credentials = self::initCredentials($credentials);
     /**
      * 第三方登录不验证credential, 本地用户验证密码
      */
     if (in_array($credentials['type'], ['email', 'username', 'phone'])) {
         $userAuth = UserAuth::where('user_id', $user->id)->where('type', $credentials['type'])->first();
         if ($this->hasher->check($credentials['credential'], $userAuth->credential)) {
             $userAuth->touch();
             return true;
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
开发者ID:zerozh,项目名称:taketwouser,代码行数:25,代码来源:TaketwoUserProvider.php

示例10: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  array  $credentials
  * @return bool
  */
 public function validateCredentials(UserContract $user, array $credentials)
 {
     $plain = $credentials['password'];
     return $this->hasher->check($plain, $user->getAuthPassword());
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:12,代码来源:DatabaseUserProvider.php

示例11: checkPassword

 /**
  * Check if a given password matches the user's password.
  *
  * @param string $password
  * @return boolean
  */
 public function checkPassword($password)
 {
     return static::$hasher->check($password, $this->password);
 }
开发者ID:ygbhf,项目名称:flarum-full,代码行数:10,代码来源:User.php

示例12: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param \Illuminate\Contracts\Auth\Authenticatable $user
  * @param array                                      $credentials
  *
  * @return bool
  */
 public function validateCredentials(AuthenticatableContract $user, array $credentials)
 {
     return $this->hasher->check($credentials['password'], $user->getAuthPassword());
 }
开发者ID:rosstuck,项目名称:Laravel-Doctrine,代码行数:12,代码来源:DoctrineUserProvider.php

示例13: confirmPassword

 /**
  * Validates the authenticated user's password
  *
  * @param $user_password
  * @return bool
  */
 public function confirmPassword($user_password)
 {
     $current_password = $this->user->getAuthPassword();
     $status = $this->hasher->check($user_password, $current_password);
     return $status;
 }
开发者ID:muhamadsyahril,项目名称:ecommerce-1,代码行数:12,代码来源:AccountsRepository.php

示例14: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  Authenticatable $user
  * @param  array $credentials
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     $password = $credentials['password'];
     return $this->hasher->check($password, $user->getAuthPassword());
 }
开发者ID:Zn4rK,项目名称:laravel-template,代码行数:12,代码来源:DoctrineUserProvider.php

示例15: checkPassword

 /**
  * Check if a given password matches the user's password.
  *
  * @param string $password
  * @return bool
  */
 public function checkPassword($password)
 {
     $valid = static::$dispatcher->until(new CheckUserPassword($this, $password));
     if ($valid !== null) {
         return $valid;
     }
     return static::$hasher->check($password, $this->password);
 }
开发者ID:flarum,项目名称:core,代码行数:14,代码来源:User.php


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