/** * {@inheritdoc} */ public function authenticate($username, $password) { $uid = FALSE; if (!empty($username) && !empty($password)) { $account_search = $this->entityManager->getStorage('user')->loadByProperties(array('name' => $username)); if ($account = reset($account_search)) { if ($this->passwordChecker->check($password, $account)) { // Successful authentication. $uid = $account->id(); // Update user to new password scheme if needed. if ($this->passwordChecker->userNeedsNewHash($account)) { $account->setPassword($password); $account->save(); } } } } return $uid; }
/** * {@inheritdoc} */ public function userNeedsNewHash(UserInterface $account) { return $this->originalPassword->userNeedsNewHash($account); }