Пример #1
0
 /**
  * Log the given user ID into the application without sessions or cookies.
  *
  * @param  mixed $id
  * @return bool
  */
 public function onceUsingId($id)
 {
     if (!is_null($user = $this->provider->retrieveById($id))) {
         $this->setUser($user);
         return true;
     }
     return false;
 }
Пример #2
0
 /**
  * Get the user for the given credentials.
  *
  * @param  array  $credentials
  * @return \Illuminate\Contracts\Auth\CanResetPassword
  *
  * @throws \UnexpectedValueException
  */
 public function getUser(array $credentials)
 {
     $credentials = Arr::except($credentials, ['token']);
     $user = $this->users->retrieveByCredentials($credentials);
     if ($user && !$user instanceof CanResetPasswordContract) {
         throw new UnexpectedValueException('User must implement CanResetPassword interface.');
     }
     return $user;
 }
 /**
  * Get the user for the given credentials.
  *
  * @param array $credentials
  * @return \Krucas\LaravelUserEmailVerification\Contracts\RequiresEmailVerification
  *
  * @throws \UnexpectedValueException
  */
 public function getUser(array $credentials)
 {
     $credentials = Arr::except($credentials, ['token']);
     $user = $this->users->retrieveByCredentials($credentials);
     if ($user && !$user instanceof Contracts\RequiresEmailVerification) {
         throw new UnexpectedValueException('User must implement RequiresEmailVerification interface.');
     }
     return $user;
 }
 public function retrieveByCredentials(array $credentials)
 {
     if ($this->isUsingProvider()) {
         // get the user from the provider
         $user = $this->provider->retrieveByCredentials($credentials);
         if ($user !== null || $this->userMustExistInProvider) {
             return $user;
         }
     }
     // get the name of the credentials username field
     $usernameField = $this->getCredentialsField('username');
     // grab the username from the credentials passed
     $username = $usernameField !== null ? array_get($credentials, $usernameField) : null;
     if ($username !== null) {
         // get the user from LDAP
         return $this->ldapServer->retrieveByUsername($username);
     }
 }
 /**
  * Retrive user from auth token.
  *
  * @param AuthToken $token
  * @return Authenticatable|null
  */
 public function user(AuthToken $token)
 {
     return $this->users->retrieveByID($token->getAuthIdentifier());
 }
Пример #6
0
 /**
  * Get the user for the given email.
  *
  * @param  $email
  *
  * @return \App\Contracts\User\CanActivate
  *
  * @throws \UnexpectedValueException
  */
 public function getUser($email)
 {
     $user = $this->users->retrieveByEmail($email);
     return $user;
 }
 /**
  * Refresh the "remember me" token for the user.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return void
  */
 protected function refreshRememberToken(UserContract $user)
 {
     $user->setRememberToken($token = Str::random(60));
     $this->provider->updateRememberToken($user, $token);
 }