You are here

public function User::checkExistingPassword in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Entity/User.php \Drupal\user\Entity\User::checkExistingPassword()

Checks the existing password if set.

Parameters

\Drupal\user\UserInterface $account_unchanged: The unchanged user entity to compare against.

Return value

bool TRUE if the correct existing password was provided.

Overrides UserInterface::checkExistingPassword

See also

UserInterface::setExistingPassword().

File

core/modules/user/src/Entity/User.php, line 402
Contains \Drupal\user\Entity\User.

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

public function checkExistingPassword(UserInterface $account_unchanged) {
  return strlen($this
    ->get('pass')->existing) > 0 && \Drupal::service('password')
    ->check(trim($this
    ->get('pass')->existing), $account_unchanged
    ->getPassword());
}