You are here

public function OpenIDConnect::usernameExists in OpenID Connect / OAuth client 8

Same name and namespace in other branches
  1. 2.x src/OpenIDConnect.php \Drupal\openid_connect\OpenIDConnect::usernameExists()

Check if a user name already exists.

Parameters

string $name: A name to test.

Return value

bool TRUE if a user exists with the given name, FALSE otherwise.

1 call to OpenIDConnect::usernameExists()
OpenIDConnect::generateUsername in src/OpenIDConnect.php
Generate a username for a new account.

File

src/OpenIDConnect.php, line 563

Class

OpenIDConnect
Main service of the OpenID Connect module.

Namespace

Drupal\openid_connect

Code

public function usernameExists($name) {
  $users = $this->userStorage
    ->loadByProperties([
    'name' => $name,
  ]);
  return (bool) $users;
}