diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test index 0b48db507d5339bb9b34b91dfa2088d2b7b7cc58..263baff4896fa755057f8b3a0d5196ccffc119d2 100644 --- a/modules/simpletest/tests/upgrade/upgrade.test +++ b/modules/simpletest/tests/upgrade/upgrade.test @@ -378,6 +378,15 @@ class BasicUpgradePath extends UpgradePathTestCase { 'pass_raw' => 'admin', )); + // The previous login should've triggered a password rehash, so login one + // more time to make sure the new hash is readable. + $this->drupalLogout(); + $this->drupalLogin((object) array( + 'uid' => 1, + 'name' => 'admin', + 'pass_raw' => 'admin', + )); + // Test that the site name is correctly displayed. $this->assertText('Drupal 6', t('The site name is correctly displayed.')); diff --git a/modules/user/user.module b/modules/user/user.module index 21272477536b2a436ef988169c9272bfb0da9043..b7ebfdd1007ac953229ea467a90ff74fdce59867 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -2180,10 +2180,7 @@ function user_authenticate($name, $password) { // Update user to new password scheme if needed. if (user_needs_new_hash($account)) { - $new_hash = user_hash_password($password); - if ($new_hash) { - user_save($account, array('pass' => $new_hash)); - } + user_save($account, array('pass' => $password)); } } }