Issue #2790923 by stefanos.petrakis, jenlampton, lokapujya, alexpott, biguzis, zniki.ru, dimaro, benjf, themic8, subhojit777, thtas, kpv, Noe_, Berdir, thijsvdanker, Cottser, dcam, jhodgdon: Allow + symbol in usernames
parent
44c38848b7
commit
a5eb776a37
|
@ -7,6 +7,7 @@ Drupal 7.xx, xxxx-xx-xx (development version)
|
|||
addition: https://www.drupal.org/node/2857751).
|
||||
- Allowed callers of drupal_http_request() to optionally specify an explicit
|
||||
Host header.
|
||||
- Allowed the + character to appear in usernames.
|
||||
|
||||
Drupal 7.56, 2017-06-21
|
||||
-----------------------
|
||||
|
|
|
@ -637,7 +637,7 @@ function user_validate_name($name) {
|
|||
if (strpos($name, ' ') !== FALSE) {
|
||||
return t('The username cannot contain multiple spaces in a row.');
|
||||
}
|
||||
if (preg_match('/[^\x{80}-\x{F7} a-z0-9@_.\'-]/i', $name)) {
|
||||
if (preg_match('/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i', $name)) {
|
||||
return t('The username contains an illegal character.');
|
||||
}
|
||||
if (preg_match('/[\x{80}-\x{A0}' . // Non-printable ISO-8859-1 + NBSP
|
||||
|
|
|
@ -276,6 +276,7 @@ class UserValidationTestCase extends DrupalWebTestCase {
|
|||
'foo@example.com' => array('Valid username', 'assertNull'),
|
||||
'foo@-example.com' => array('Valid username', 'assertNull'), // invalid domains are allowed in usernames
|
||||
'þòøÇߪř€' => array('Valid username', 'assertNull'),
|
||||
'foo+bar' => array('Valid username', 'assertNull'), // '+' symbol is allowed
|
||||
'ᚠᛇᚻ᛫ᛒᛦᚦ' => array('Valid UTF8 username', 'assertNull'), // runes
|
||||
' foo' => array('Invalid username that starts with a space', 'assertNotNull'),
|
||||
'foo ' => array('Invalid username that ends with a space', 'assertNotNull'),
|
||||
|
@ -2386,7 +2387,13 @@ class UserUserSearchTestCase extends DrupalWebTestCase {
|
|||
}
|
||||
|
||||
function testUserSearch() {
|
||||
// Verify that a user without 'administer users' permission cannot search
|
||||
// for users by email address. Additionally, ensure that the username has a
|
||||
// plus sign to ensure searching works with that.
|
||||
$user1 = $this->drupalCreateUser(array('access user profiles', 'search content', 'use advanced search'));
|
||||
$edit['name'] = 'foo+bar';
|
||||
$edit['mail'] = $edit['name'] . '@example.com';
|
||||
user_save($user1, $edit);
|
||||
$this->drupalLogin($user1);
|
||||
$keys = $user1->mail;
|
||||
$edit = array('keys' => $keys);
|
||||
|
|
Loading…
Reference in New Issue