Make WordPress Core

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)

17793.diff​ (1.9 KB ) - added by solarissmoke 15 years ago.
17793.2.diff​ (1.9 KB ) - added by MikeHansenMe 14 years ago.
same just refreshed
17793.3.diff​ (2.0 KB ) - added by MikeHansenMe 11 years ago.

Download all attachments as: .zip

Change History (11)

#1 @SergeyBiryukov
15 years ago

  • Keywords needs-patch added; i18n-change removed

Related: [14428], #13162

@solarissmoke
15 years ago

#2 @solarissmoke
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?

#3 @kurtpayne
15 years ago

  • Cc kpayne@… added
  • Version → 2.1

@MikeHansenMe
14 years ago

same just refreshed

#4 @MikeHansenMe
14 years ago

  • Cc mdhansen@… added

#5 @chriscct7
11 years ago

  • Keywords needs-refresh added; has-patch removed
  • Severity trivial → normal

#6 @MikeHansenMe
11 years ago

  • Keywords has-patch added; needs-refresh removed

#7 @chriscct7
11 years ago

  • Owner set to chriscct7
  • Status new → reviewing

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

Note: See TracTickets for help on using tickets.