Problem/Motivation
This is a problem for both 6.x and 7.x. The name field for users allows the @ symbol despite the #description for the field saying otherwise. With 6.17, the user module was brought in line with 7.x-dev in allowing apostrophes as well as period, underscore, hyphen, and @, so its #description for the name field is now even more incorrect than it was before (doesn't mention apostrophes)
The code to verify the acceptable characters is in comment #55.
There is also an outstanding issue to change the allowed characters: #1290528: Disallow English symbols and math characters in Username
Current wording:
Spaces are allowed; punctuation is not allowed except periods, hyphens, apostrophes, and underscores.
Proposed resolution
The sentence should be changed to :
Several special characters are allowed, including space, period (.), hyphen (-), apostrophe ('), underscore (_), and the @ sign.
User interface changes
Before:
After:
Beta phase evaluation
Issue category | Bug because the current description incorrectly identifies which characters are allowed in username field. |
---|---|
Issue priority | Normal |
Unfrozen changes | Unfrozen because it only changes a translatable string. |
Prioritized changes | The main goal of this issue is usability |
Disruption | Not disruptive because it only affects words in a translatable string. |
Comment | File | Size | Author |
---|---|---|---|
#70 | before_patch.JPG | 26.71 KB | Truptti |
#70 | validation_after_patch.JPG | 43.47 KB | Truptti |
#70 | after_patch_1.JPG | 123.83 KB | Truptti |
#67 | fix_the_allowed-827468-67.patch | 1.67 KB | aburrows |
| |||
#67 | Configure_site___Drupal.png | 379.14 KB | aburrows |
Comments
Comment #1
mgriego CreditAttribution: mgriego commentedComment #2
dddave CreditAttribution: dddave commentedConfirmed. I guess D8 is the place to work on it.
Comment #3
bleen CreditAttribution: bleen commentedmore susinct:
Comment #4
drupal_was_my_past CreditAttribution: drupal_was_my_past commentedHow about this: Spaces as well as the following special characters are allowed: @.'_-
Patch attached.
Comment #5
droplet CreditAttribution: droplet commentedmore than @.'_- are allowed
I started another new issue related to this topic: #1290528: Disallow English symbols and math characters in Username
Comment #6
dcam CreditAttribution: dcam commentedClosed a duplicate issue.
Comment #7
dcam CreditAttribution: dcam commentedOops. I didn't add the related duplicate issue correctly.
Comment #8
meeli CreditAttribution: meeli commentedThis is tricky. So the questions I think we need to ask are:
Comment #9
gsharm CreditAttribution: gsharm at Srijan | A Material+ Company commentedComment #10
gsharm CreditAttribution: gsharm at Srijan | A Material+ Company commentedComment #11
ifrikComment #12
ifrik"Spaces as well as the following special characters are allowed" is a good solution to shorten the sentences and to get around the akward semicolon.
However, the names of the allowed characters should be spelled out for readability, because characters such as apostrophes are not always distinguishable from similar characters, especially when the help text is in a small font size.
Alternatively, the characters could be placed after their name.
Comment #13
latikas CreditAttribution: latikas commentedHow about this: Spaces and special characters are also allowed like periods(.), hyphens(-), apostrophes('""'), underscore (_) and the @ symbol.
Patch attached.
Comment #14
latikas CreditAttribution: latikas commentedRe-rolled patch according to #12
Comment #17
latikas CreditAttribution: latikas commentedComment #21
anil.gangwal CreditAttribution: anil.gangwal as a volunteer and at Publicis Sapient for Publicis Sapient commentedupdating credit
Comment #22
anil.gangwal CreditAttribution: anil.gangwal at Publicis Sapient for Publicis Sapient commentedupdating credit
Comment #23
DuaelFrThe modules/user/user.module file does not exist anymore and forms now follows the PSR-4 standard.
You should now look in core/modules/user/src/AccountForm.php
Comment #24
paulmartin84 CreditAttribution: paulmartin84 commentedComment #25
paulmartin84 CreditAttribution: paulmartin84 commentedComment #26
paulmartin84 CreditAttribution: paulmartin84 commentedIn #25 I mistakenly changed the SiteConfigureForm, please ignore the previous patch, Here is the correct one that targets the AccountForm,
Comment #27
paulmartin84 CreditAttribution: paulmartin84 commentedComment #29
danharper CreditAttribution: danharper as a volunteer commentedWorking on this.
Comment #30
danylevskyiI'm a mentor. Helping @danharper to work on the issue.
Comment #31
nlisgo CreditAttribution: nlisgo commentedGO @danharper!
Comment #32
danharper CreditAttribution: danharper as a volunteer and at Curve Agency commentedPatch applies properly and solves the issue marking as RTBC.
Comment #33
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedIt would be nice to have screenshots of this. @danylevskyi, @danharper - can you work with another sprinter to add screenshots to this issue?
Comment #34
alimac CreditAttribution: alimac at University of Illinois at Chicago commenteddouble post
Comment #35
pektinasen CreditAttribution: pektinasen commentedI'll do the screenshots.
Comment #36
pektinasen CreditAttribution: pektinasen commentedComment #37
pektinasen CreditAttribution: pektinasen commentedComment #38
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedGreat. Can we add the screenshots to the issue summary and also use the issue summary template?
https://www.drupal.org/issue-summaries
Comment #39
fatfish CreditAttribution: fatfish as a volunteer and at FatFish commentedComment #40
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedI am setting the priority to Normal. Per https://www.drupal.org/core/issue-priority "minor" issues are cosmetic changes. Here the description was giving incorrect information about what characters are allowed.
Comment #41
danylevskyiComment #42
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedAdded a beta evaluation.
Comment #43
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedComment #44
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedPer suggestion from @webchick, I searched for the string "Spaces are allowed;" to make sure that this is the only instance of the string, but it also shows up in another file (site configuration form). The description should be changed in both places.
Also, we should run this by UX maintainer since this change affects a form used by a lot of people.
Comment #45
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedAlso, let's simplify the string to: "These special characters are allowed: space, period (.), hyphen (-), apostrophes (‘), underscore (_), and the @ sign."
Comment #46
fatfish CreditAttribution: fatfish as a volunteer and at FatFish commentedComment #47
danylevskyiComment #48
YesCT CreditAttribution: YesCT commentedWhy double quotes? I think that should stay single quotes.
Comment #49
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedAddressing comment #48.
Comment #50
paulmartin84 CreditAttribution: paulmartin84 commented(') is an Apostrophe and (‘) is a Left Single Quotation mark Which one is this issue referring to?
Comment #51
webchickSadly, when this patch was presented in front of everyone at DrupalCon Barcelona, we discovered that we don't know what ' is. So we should figure that out. ;)
Comment #52
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedGood question. I tested both and they are both accepted.
Comment #53
YesCT CreditAttribution: YesCT commentedI think we need to check the code and see what is actually allowed.
Then... we might need to re-evaluate if we actually want to list them *all*.
And I think a reference, added to the issue summary, clarifying what is a single quote, apostrophe, smart quote, back tick, etc.
Comment #54
realityloopI checked with a program called Ultra Character Map on OSX
' is called "Apostrophe" and doesn't have a unicode value
` is called "Grave Accent" it is unicode u0060
‘ is called a "Left Single Quotation Mark" it is unicode u2018
’ is called a "Right Single Quotation Mark" it is unicode u2019
Comment #55
John Cook CreditAttribution: John Cook commentedIn
UserNameConstraintValidator::validate()
the code to check for invalid username characters is:Comment #56
YesCT CreditAttribution: YesCT commentedrelated info as to how we format the *code* for the string:
https://www.drupal.org/coding-standards#quotes
Comment #57
John Cook CreditAttribution: John Cook commentedComment #58
John Cook CreditAttribution: John Cook commentedUpdated issue summary.
Comment #59
realityloopI think it makes sense to only tell people the "logical" characters..
#448074: @ style mentions for usernames which send notifications for D.o is possibly relevant
Comment #60
susanb CreditAttribution: susanb commentedI'm going to make an attempt to clarify the text and submit a new patch for review.
Comment #61
ifrikLooks like several people were trying out all kinds of special characters yesterday after the Live Review, and lots of them can be used - too many for making a definite list.
The best solution might be to make a non-exclusive list of examples:
Several special characters are allowed, including space, period (.), hyphen (-), apostrophes (‘), underscore (_), the @ sign, and more.
And only include examples that we can clearly identify.
Comment #62
YesCT CreditAttribution: YesCT commentedok. but I think if we are going to include the word "apostrophe" then it should be ' and not ‘ which is a Left Single Quotation Mark.
@susanb maybe you had some questions when you tried?
I suggest
without the "and more" since the "including" says that.
Comment #63
YesCT CreditAttribution: YesCT commenteduhh.. and that is the only plural, ... and and. :)
so really I suggest. ...
Comment #64
DuaelFrI can confirm what @ifrik says in #61 ;)
Can't we just write something like the following?
Or what about explaining the characters that are *not* allowed?
Comment #65
aburrows CreditAttribution: aburrows as a volunteer commentedThe validation is working, so its more the case of changing the text, I agree with YesCT and we should make it identifieable with the symbols between ().
Comment #66
aburrows CreditAttribution: aburrows as a volunteer commentedComment #67
aburrows CreditAttribution: aburrows as a volunteer commentedPatch and screenshot attached, implementing YesCT suggestion
Comment #70
Truptti CreditAttribution: Truptti at Axelerant commentedVerified the issue with the patch ' fix_the_allowed-827468-67.patch'.
1.The phrase is now displayed as ' Several special characters are allowed, including space, period (.), hyphen (-), apostrophe ('), underscore (_), and the @ sign. '
2.Error is displayed if other special characters are written in username
Attached snapshot for reference.
Comment #71
Truptti CreditAttribution: Truptti at Axelerant commentedComment #72
alimac CreditAttribution: alimac at University of Illinois at Chicago commented@Truptti: thanks for reviewing the patch!
Can you update the issue summary and replace the old screenshots with yours? Also, the proposed resolution needs to be updated to reflect @YesCT's suggestion in #63.
Comment #73
Truptti CreditAttribution: Truptti at Axelerant commentedComment #74
Truptti CreditAttribution: Truptti at Axelerant commentedComment #75
Truptti CreditAttribution: Truptti at Axelerant commentedComment #76
Truptti CreditAttribution: Truptti at Axelerant commented@alimac : Updated the screenshot and the proposed resolution in the issue summary.
Comment #80
alvar0hurtad0It seems that the state is automatically changed to a failure in the test. But the patch pass the tests now.
Comment #83
webchickYAY! So happy to see this in! Sorry it didn't happen LIVE at Drupalcon "Brewshaloona"! ;)
Committed and pushed to 8.0.x. Thanks!!
(Sorry, not sure who to credit so just crediting everyone.)
Comment #84
webchick