You are here

public function Storage::checkUserCredentials in OAuth2 Server 7

File

lib/Drupal/oauth2_server/Storage.php, line 300

Class

Storage
Provides Drupal storage (through the underlying Entity API) for the library.

Namespace

Drupal\oauth2_server

Code

public function checkUserCredentials($username, $password) {
  $account = user_load_by_name($username);
  if (!$account) {

    // An email address might have been supplied instead of the username.
    $account = user_load_by_mail($username);
  }
  if ($account && $account->status) {
    require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
    return user_check_password($password, $account);
  }
  return FALSE;
}