You are here

public function W3CTokenManager::getUserFromToken in W3C Validator 8

Retrieve a user from a token.

Parameters

string $token: The access token to check.

Return value

\Drupal\user\Entity\User|null An access token or null if not existing or expired.

File

src/W3CTokenManager.php, line 95

Class

W3CTokenManager
Token manager: allow to be logged as a user from URL.

Namespace

Drupal\w3c_validator

Code

public function getUserFromToken($token) {
  $result = $this->database
    ->select('w3c_access_token', 't')
    ->fields('t')
    ->condition('token', $token)
    ->execute()
    ->fetchObject();
  return User::load($result->uid);
}