Make WordPress Core

Opened 6 years ago

Last modified 4 years ago

#44690 new enhancement

Username should not accept space

Reported by: subrataemfluence's profile subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Users Keywords: 2nd-opinion
Focuses: Cc:

Description

The username field accepts space, not leading or trailing ones though. Space is usually not in the list of accepted characters.

I am not sure if it is there in purpose. Ideally it should not accept this character.

Username also accepts @, which is not an issue. But the problem starts when the username looks like an email address! When sending verification requests for Export and Erase private data the issue can be noticed.

However, if username has to accept @, WordPress should first check whether it is validating email address pattern. If it does, I think that should be reported rather than allowing it to get saved.

I explained the above issue in #44683.

Change History (4)

#1 @knutsp
6 years ago

I don't know is space is a problem, but email-looking usernames are. You can log in with either username or email, fine, but what if you are trying to log in using a email-like username? Two user may have the same string as username in one profile, and as email in the other.

@ is not the problem, but if a username validates as email, it should be rejected.

A completely different approach would be to deprecate usernames in favour of email, but that would be a drastic change.

#2 @pento
6 years ago

  • Version trunk deleted

#4 @vegasgeek
4 years ago

When adding a username that contains a trailing space (it was an accident), the error message reads:

Error: This username is invalid because it uses illegal characters. Please enter a valid username.

Since the username field accepts a space in the middle of the username, but not as a leading or trailing character, this is misleading and can cause confusion.

Note: See TracTickets for help on using tickets.