For now I can register user with name test@example.com or te.st@example.com, but not with test+work@example.com.
I suggest to allow plus sign in user_validate_name() function.
Patch attached.

Comments

kalabro’s picture

Status: Active » Needs review

Maybe we should run tests

kristen pol’s picture

I tested this in Drupal 7 (own patch with your code) and it works well. Thanks!

kristen pol’s picture

Issue summary: View changes

Updated issue summary.

fuzzy76’s picture

Issue summary: View changes
StatusFileSize
new608 bytes
fuzzy76’s picture

Added a D7 backport rolled against 7.x head.

Status: Needs review » Needs work

The last submitted patch, 3: d7-allow-plus-for-username-1821974-3.patch, failed testing.

attiks’s picture

Status: Needs work » Needs review
fuzzy76’s picture

Status: Needs review » Needs work

The last submitted patch, 3: d7-allow-plus-for-username-1821974-3.patch, failed testing.

fuzzy76’s picture

Status: Needs work » Needs review

Sorry about that

durgeshs’s picture

Status: Needs review » Needs work

The last submitted patch, 3: d7-allow-plus-for-username-1821974-3.patch, failed testing.

durgeshs’s picture

I have tested core d7 and d8 for "Allow plus sign in user_validate_name to be able to use email as login", It is already working fine without any patch. I don't know why want to create new patch for that while already allow plus sign in user_validate_name for login and register.

durgeshs’s picture

Status: Needs work » Closed (works as designed)

I don't know why want to create new patch for that while already allow plus sign in user_validate_name for login and register.

attiks’s picture

Status: Closed (works as designed) » Needs review

If I read the code correctly at https://api.drupal.org/api/drupal/modules%21user%21user.module/function/... it says

 if (preg_match('/[^\x{80}-\x{F7} a-z0-9@_.\'-]/i', $name)) {
    return t('The username contains an illegal character.');
  }

so a plus sign as part of the user name is not allowed.

maestrojed’s picture

StatusFileSize
new61.85 KB

I could not reproduce this issue on the latest d8 dev branch.

I was able to to create an account using a plus sign (+) in my username.

I confirmed the email address was stored with a + sign for this user. I confirmed by looking at both the admin panel (http://drupal8.dev/admin/people) and the database.

I did receive an error due to another issue. (I mention because you can see this error in my screenshot)
https://drupal.org/node/2281603
But this issue is separate and exists for email addresses without a + sign.

Although I could not reproduce this, if others can, I agree its important to allow plus signs in emails. Many google/gmail users are accustomed to creating email address aliases on the fly by including a plus sign.

I included a screenshot.

attiks’s picture

Version: 8.x-dev » 7.x-dev

If this is already working for D8, we need a backport for D7

attiks’s picture

dcam’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Needs work
StatusFileSize
new9.71 KB

I tested this in D8 and adding a username with a '+' did result in the error shown in the screenshot below.

Note that in the screenshot I was testing it without the email domain to make sure there was no error from other punctuation characters.

I also checked the username validation code. The preg_match string is exactly the same as is mentioned for D7 in #14. See validate() in /core/modules/user/src/Plugin/Validation/Constraint/UserNameContraintValidator.php.

dcam’s picture

Status: Needs work » Closed (duplicate)

I'm closing this as a duplicate of #2157963: Allow + symbol in usernames. Although this is the older of the two issues, the D8 patch in the other issue is slightly more up-to-date.