mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 11:14:36 +00:00
Authentication: Allow users to log in using their email address.
Introduces `wp_authenticate_email_password()` which is hooked into `authenticate` after `wp_authenticate_username_password()`. Props Denis-de-Bernardy, ericlewis, vhomenko, MikeHansenMe, swissspidy, ocean90. Fixes #9568. git-svn-id: https://develop.svn.wordpress.org/trunk@36617 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -311,4 +311,21 @@ class Tests_Auth extends WP_UnitTestCase {
|
||||
$check = check_password_reset_key( '', $this->user->user_login );
|
||||
$this->assertInstanceOf( 'WP_Error', $check );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure users can log in using both their username and their email address.
|
||||
*
|
||||
* @ticket 9568
|
||||
*/
|
||||
function test_log_in_using_email() {
|
||||
$user_args = array(
|
||||
'user_login' => 'johndoe',
|
||||
'user_email' => 'mail@example.com',
|
||||
'user_pass' => 'password',
|
||||
);
|
||||
$this->factory->user->create( $user_args );
|
||||
|
||||
$this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_email'], $user_args['user_pass'] ) );
|
||||
$this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_login'], $user_args['user_pass'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user