Opened 15 years ago
Last modified 4 weeks ago
#17793 reviewing defect (bug)
No explanation on invalid characters on registration form
| Reported by: | molnarm | Owned by: | chriscct7 |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Users | Version: | 2.1 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
When a user tries to register with a username containing special characters (e.g. accented letters), WP shows an error message saying "This username is invalid because it uses illegal characters. Please enter a valid username.".
However, this doesn't really help the user because the message does not explain how to fix the problem, i.e. which characters are allowed.
Please consider adding a brief listing of allowed characters.
Attachments (3)
Change History (11)
#2
@
15 years ago
- Keywords has-patch added; needs-patch removed
Patch adds a message modelled on what Google tells you when you try to sign up for an account using funky characters.
I should say that sanitize_user() also allows spaces and @ in usernames, but I'm not sure we should be encouraging that?
This ticket was mentioned in PR #13532 on WordPress/wordpress-develop by skikken.
4 weeks ago
#8
- Keywords has-unit-tests added
When a username is rejected for containing disallowed characters, the error only said the username was invalid and asked for "a valid username". That does not tell the person registering which characters are actually accepted, so the message did not help them correct the problem.
The message now names the allowed characters. This matches what multisite already reports through wpmu_validate_user_signup() ("Usernames can only contain lowercase letters (a-z) and numbers."), so single site registration was the outlier rather than this being a new direction.
The string appears in three places and all three were updated: register_new_user(), edit_user() in wp-admin, and the users REST controller. The REST copy is the same message without the "<strong>Error:</strong>" prefix, since REST errors are not rendered as admin notices.
A username can also contain a space or an @, because both survive sanitize_user(). Listing those was raised on the ticket and deliberately left out: the recommendation there was to avoid encouraging them, and advertising them as valid would need sanitize_user() tightened first, which is a much larger change than this ticket.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Sonnet
Used for: test cases, code review
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Related: [14428], #13162