This blog post information will help in the drupal login attempt failure. This issue generally comes, if you shift your drupal setup from local to live server or shift from one server to another server.
You need to place the following code snippet into this file path.
File Path: DRUPALROOT\core\modules\user\src\UserAuth.php
Function Name: authenticate($username, $password)
1. Code Snippet
echo $password; echo '<br/>'; echo $this->passwordChecker->needsRehash($password); echo '<br/>'; $account->setPassword($password); $account->save(); echo $this->passwordChecker->check($password, $account->getPassword()); die();
2. Full Function Code
public function authenticate($username, $password) { $uid = FALSE; if (!empty($username) && strlen($password) > 0) { $account_search = $this->entityTypeManager->getStorage('user')->loadByProperties(['name' => $username]); if ($account = reset($account_search)) { if ($this->passwordChecker->check($password, $account->getPassword())) { // Successful authentication. $uid = $account->id(); // Update user to new password scheme if needed. if ($this->passwordChecker->needsRehash($account->getPassword())) { $account->setPassword($password); $account->save(); } } } //echo $password, $account->getPassword(); echo $this->passwordChecker->needsRehash($password); $account->setPassword($password); $account->save(); echo $this->passwordChecker->check($password, $account->getPassword()); die(); } return $uid; }
This code snippet will re-hash your current password. After one attempt you need to remove the extra code from the function and re-upload the file.
Then try your drupal login. Drupal login issue will fix.
Note: Before trying this code, you must know what you are doing, if you are not a PHP programmer, please ignore this. One more thing, before trying this code, you must sure that your username is existing in the database.