function UserAuthentication::lookupAccount

Overrides UserAuthenticationInterface::lookupAccount

File

core/modules/user/src/UserAuthentication.php, line 62

Class

UserAuthentication
Validates user authentication credentials.

Namespace

Drupal\user

Code

public function lookupAccount($identifier) : UserInterface|false {
    if (!empty($identifier)) {
        $account_search = $this->entityTypeManager
            ->getStorage('user')
            ->loadByProperties([
            'name' => $identifier,
        ]);
        if ($account = reset($account_search)) {
            return $account;
        }
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.