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


PHP AuthManager::attempt方法代码示例

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


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

示例1: auth

 /**
  * Authenticate request.
  *
  * @return bool|exception
  */
 public function auth()
 {
     if (!$this->auth->attempt($this->getCredentials())) {
         throw new InvalidBasicAuthCredentials();
     }
     return true;
 }
开发者ID:devdk,项目名称:signy,代码行数:12,代码来源:Basic.php

示例2: handle

 /**
  * Handle the command
  *
  * @param $command
  * @throws InvalidCredentialsException
  * @return mixed
  */
 public function handle($command)
 {
     foreach ($this->availableIdentifiers() as $identifier) {
         $attemptable = [$identifier => $command->identifier, 'password' => $command->password];
         if ($this->authManager->attempt($attemptable, $command->remember)) {
             return true;
         }
     }
     $this->throwError();
 }
开发者ID:reshadman,项目名称:hammihan-online,代码行数:17,代码来源:LoginCommandHandler.php

示例3: login

 /**
  * @param $username
  * @param $password
  * @throws MissingInput
  * @throws AuthenticationFailed
  */
 public function login($username, $password)
 {
     $missing_fields = [];
     if (!$username || $username === '') {
         $missing_fields[] = 'username';
     }
     if (!$password || $password === '') {
         $missing_fields[] = 'password';
     }
     if (count($missing_fields) > 0) {
         throw new MissingInput($missing_fields);
     }
     if (!$this->auth->attempt(array('email' => $username, 'password' => $password))) {
         throw new AuthenticationFailed();
     }
 }
开发者ID:coandacms,项目名称:coanda-core,代码行数:22,代码来源:UserManager.php

示例4: handleLogin

 public function handleLogin(AuthManager $auth, Request $request)
 {
     // Set the auth data
     $userData = ['email' => $request->get('email'), 'password' => $request->get('password')];
     // Log in successful
     if ($auth->attempt($userData)) {
         return redirect()->intended(route('home'))->with('message', 'You have been logged in.');
     }
     // Login failed
     return redirect(route('auth.login'))->with('error', 'Your username or password was incorrect.');
 }
开发者ID:NukaCode,项目名称:Miranda,代码行数:11,代码来源:AuthController.php

示例5: postLogin

 public function postLogin()
 {
     if ($this->auth->attempt($this->request->only('email', 'password'))) {
         $url = $this->request->get("url");
         if ($url == null) {
             return $this->redirector->route("dashboard");
         }
         return $this->redirector->to($this->request->get("url"));
     }
     return $this->redirector->route('home');
 }
开发者ID:PhonemeCms,项目名称:cms,代码行数:11,代码来源:UserController.php

示例6: login

 /**
  * Given correct credentials, log a user in.
  *
  * @param  array   $credentials
  * @param  boolean $remember
  *
  * @return bool
  * @throws AuthenticationException
  */
 public function login(array $credentials, $remember = false)
 {
     $credentials['is_active'] = 1;
     // if the "eloquent-exceptions" driver is being used, an exception will
     // be thrown if authentication failed. if one of the stock drivers are
     // being used, it will just return false, and we have to throw the
     // exception ourselves, with less information.
     if (!$this->auth->attempt($credentials, $remember)) {
         throw new AuthenticationException('Illuminate\\Auth\\Guard::attempt returned false');
     }
     $this->getCurrentUser()->rehashPassword($credentials['password']);
     return true;
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:22,代码来源:UserManager.php

示例7: postIndex

 /**
  * Show the login form
  *
  * @return mixed
  */
 public function postIndex()
 {
     // Pick up the honeypot field to stop bots, return to the login screen, no message
     if ($this->request->get('potter')) {
         return $this->redirect->to('auth/login')->withInput();
     }
     if (!$this->validator->with($this->request->all())->passes()) {
         return $this->redirect->to('auth/login')->withErrors($this->validator->errors());
     }
     if ($this->auth->attempt(['username' => $this->request->get('username'), 'password' => $this->request->get('password')])) {
         return $this->redirect->intended('/');
     }
     $this->session->flash('failed', trans('auth.incorrect_username_or_password'));
     return $this->redirect->to('auth/login')->withInput();
 }
开发者ID:jraymundoyrockdev,项目名称:api-gfccm-systems,代码行数:20,代码来源:AuthController.php

示例8: run

 public function run()
 {
     if (!$this->auth->attempt($this->credentials, $this->remember)) {
         $this->addError('Invalid username / password combination');
     }
 }
开发者ID:imihael,项目名称:fluxbb-core,代码行数:6,代码来源:Login.php

示例9: login

 public function login($email, $password, $remember = false)
 {
     return $this->auth->attempt(compact('email', 'password'), $remember);
 }
开发者ID:adibhanna,项目名称:agency,代码行数:4,代码来源:AdminAuthenticator.php


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