Follow-up to #2157963: Allow + symbol in usernames

Problem/Motivation

My use case is that my usernames and email addresses match exactly - they have been imported from a previous system where users logged in with their email address and had no username. This works for almost all users, except where an email address contains the + character. In those cases my users are unable to edit their profiles because drupal throws a validation error on save:
The username contains an illegal character.

Proposed resolution

Add + character to the regex.

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Comments

naveenvalecha created an issue. See original summary.

naveenvalecha’s picture

Please credit the @themic8 for the patch in the previous issue.

stefanos.petrakis’s picture

Re-rolling the original patch from @themic8 from https://www.drupal.org/node/2157963#comment-8415901 as well as the tests from the final 8.2.x patch (from that issue), adjusted accordingly for D7.

stefanos.petrakis’s picture

Status: Active » Needs review

And setting status to "needs review"

Status: Needs review » Needs work

The last submitted patch, 3: drupal-allow-plus-in-usernames-2790923-3.patch, failed testing.

stefanos.petrakis’s picture

Status: Needs work » Needs review

Reviews are welcome.

dahousecat’s picture

Applies cleanly and works fine for me

ndobromirov’s picture

Shouldn't the + be escaped like \+?

stefanos.petrakis’s picture

Do you mean in this regex:

'/[^\x{80}-\x{F7} a-z0-9@+_.\'-]/i'

If that is what you mean, then no, it does not need to be escaped, the [] (character class notation) takes care of that and treats the + sign as a literal.

ndobromirov’s picture

Yes it's related to the reg-ex. Sorry I was not that specific and thanks for the answer.

stefanos.petrakis’s picture

No problem, thanks for looking into this. Did you have a change to test/review this further?

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs backport to D7

Patch applies cleanly and works for me, thank you!

stefan.r’s picture

Issue tags: +Drupal bugfix target
David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +7.60 release notes

Committed to 7.x - thanks!

  • David_Rothstein committed a5eb776 on 7.x
    Issue #2790923 by stefanos.petrakis, jenlampton, lokapujya, alexpott,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jenlampton’s picture

Patch still applies cleanly to 7.57. Can't wait for 7.60! :)

jenlampton’s picture

Patch in #3 still applies (with offset) to Drupal 7.58.

jenlampton’s picture

Patch in #3 also still applies (with offset) to Drupal 7.59.

RAWDESK’s picture

Patch in #3 applied and tested successfully to Drupal 7.59. Couldn't wait for 7.60! ;)