Login and Registration: Allow email logins to be more flexible.

Allows a login to have an apostorphe. Which would normally be created as a mistake, but this allows the login to happen.

Fixes #38744
Props wpkuf, desrosj, socalchristina, bibliofille, santilinwp, nsubugak, sncoker, cafenoirdesign, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@46640 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock
2019-11-03 20:10:23 +00:00
parent 9d88dbac58
commit 84c794ba41
4 changed files with 38 additions and 4 deletions
+34
View File
@@ -35,6 +35,22 @@ class Tests_User extends WP_UnitTestCase {
);
self::$user_ids[] = self::$contrib_id;
self::$user_ids[] = $factory->user->create(
array(
'user_login' => "testemailaddress'@test.com",
'user_nicename' => 'user_email_with_apostrophe',
'user_pass' => 'password',
'first_name' => 'John',
'last_name' => 'Doe',
'display_name' => 'John Doe',
'user_email' => "testemailaddress'@test.com",
'user_url' => 'http://tacos.com',
'role' => 'contributor',
'nickname' => 'Johnny',
'description' => 'I am a WordPress user that cares about privacy.',
)
);
self::$author_id = $factory->user->create(
array(
'user_login' => 'author_login',
@@ -65,6 +81,24 @@ class Tests_User extends WP_UnitTestCase {
$this->author = clone self::$_author;
}
public function test_that_you_can_login_with_an_email_that_has_apostrophe() {
//create the user with an email that has an apostrophe (see test setup)
//login as the user
$credentials = [
'user_login' => "testemailaddress'@test.com",
'user_password' => 'password',
];
//attempt to login
$user = wp_signon( $credentials );
//assert that login was successfull
//if the login fails, an instance of WP_Error is returned rather than User object
$this->assertNotWPError( $user );
}
function test_get_users_of_blog() {
// add one of each user role
$nusers = array(