mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Users: Fetch user by login in retrieve_password() if not found by email.
This ensures that sending a password reset link works as expected if the user's login and email were initially the same, but the email address was subsequently updated and no longer matches the login, which is still set to the old address. Follow-up to [6643], [18513], [19056], [37474], [50129], [50140]. Props donmhico, pbearne, azouamauriac, boblindner, daxelrod, audrasjb, SergeyBiryukov. Fixes #53634. git-svn-id: https://develop.svn.wordpress.org/trunk@54477 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -47,8 +47,7 @@ class Tests_User_RetrievePassword extends WP_UnitTestCase {
|
||||
* @ticket 54690
|
||||
*/
|
||||
public function test_retrieve_password_reset_notification_email() {
|
||||
$message = 'Sending password reset notification email failed.';
|
||||
$this->assertNotWPError( retrieve_password( $this->user->user_login ), $message );
|
||||
$this->assertNotWPError( retrieve_password( $this->user->user_login ), 'Sending password reset notification email failed.' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +63,21 @@ class Tests_User_RetrievePassword extends WP_UnitTestCase {
|
||||
}
|
||||
);
|
||||
|
||||
$message = 'Sending password reset notification email succeeded.';
|
||||
$this->assertWPError( retrieve_password( $this->user->user_login ), $message );
|
||||
$this->assertWPError( retrieve_password( $this->user->user_login ), 'Sending password reset notification email succeeded.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 53634
|
||||
*/
|
||||
public function test_retrieve_password_should_fetch_user_by_login_if_not_found_by_email() {
|
||||
self::factory()->user->create(
|
||||
array(
|
||||
'user_login' => 'foo@example.com',
|
||||
'user_email' => 'bar@example.com',
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertTrue( retrieve_password( 'foo@example.com' ), 'Fetching user by login failed.' );
|
||||
$this->assertTrue( retrieve_password( 'bar@example.com' ), 'Fetching user by email failed.' );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user