Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UserAuthentication.php

function UserAuthentication::authenticateAccount

Overrides UserAuthenticationInterface::authenticateAccount

1 call to UserAuthentication::authenticateAccount()
UserAuthentication::authenticate in core/modules/user/src/UserAuthentication.php

File

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

Class

UserAuthentication
Validates user authentication credentials.

Namespace

Drupal\user

Code

public function authenticateAccount(UserInterface $account, string $password) : bool {
    if ($this->passwordChecker
        ->check($password, $account->getPassword())) {
        // Update user to new password scheme if needed.
        if ($this->passwordChecker
            ->needsRehash($account->getPassword())) {
            $account->setPassword($password);
            $account->save();
        }
        return TRUE;
    }
    return FALSE;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal