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
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | drupal-allow-plus-in-usernames-2790923-3.patch | 2.12 KB | stefanos.petrakis |
Comments
Comment #2
naveenvalechaPlease credit the @themic8 for the patch in the previous issue.
Comment #3
stefanos.petrakisRe-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.
Comment #4
stefanos.petrakisAnd setting status to "needs review"
Comment #6
stefanos.petrakisReviews are welcome.
Comment #7
dahousecat commentedApplies cleanly and works fine for me
Comment #8
ndobromirov commentedShouldn't the + be escaped like \+?
Comment #9
stefanos.petrakisDo 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.
Comment #10
ndobromirov commentedYes it's related to the reg-ex. Sorry I was not that specific and thanks for the answer.
Comment #11
stefanos.petrakisNo problem, thanks for looking into this. Did you have a change to test/review this further?
Comment #12
jenlamptonPatch applies cleanly and works for me, thank you!
Comment #13
stefan.r commentedComment #14
David_Rothstein commentedCommitted to 7.x - thanks!
Comment #17
jenlamptonPatch still applies cleanly to 7.57. Can't wait for 7.60! :)
Comment #18
jenlamptonPatch in #3 still applies (with offset) to Drupal 7.58.
Comment #19
jenlamptonPatch in #3 also still applies (with offset) to Drupal 7.59.
Comment #20
RAWDESK commentedPatch in #3 applied and tested successfully to Drupal 7.59. Couldn't wait for 7.60! ;)