You are here

function openid_connect_username_alter in OpenID Connect / OAuth client 7

Implements hook_username_alter().

File

./openid_connect.module, line 425
A pluggable client implementation for the OpenID Connect protocol.

Code

function openid_connect_username_alter(&$name, $account) {

  // Ensure that usernames are not displayed if they are email addresses, or if
  // they are generated names starting with 'oidc_'.
  if (!empty($account->data['oidc_name']) && (strpos($name, 'oidc_') === 0 || strpos($name, '@'))) {
    $name = $account->data['oidc_name'];
  }
}