User tests: Successful: Unsuccessful:
Pull Request resolves #
Updated the username validation in libraries/src/Table/User.php to reject whitespace characters anywhere in the username.
Previously, Joomla could accept usernames containing spaces, such as Ahmad Moussa. The validation now also checks for whitespace between characters, while keeping the existing validation for leading and trailing whitespace.
Examples:
"AhmadMoussa" → accepted
"Ahmad Moussa" → rejected
" AhmadMoussa" → rejected
"AhmadMoussa " → rejected
Create or edit a Joomla user and test the following usernames:
"AhmadMoussa"
"Ahmad Moussa"
" AhmadMoussa"
"AhmadMoussa "
Verify that usernames without whitespace are accepted and usernames containing whitespace are rejected.
Joomla allowed usernames containing spaces between words, such as "Ahmad Moussa".
Joomla rejects usernames containing whitespace characters, including spaces between words and leading or trailing whitespace.
Please select:
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look
Hello @brianteeman, I have found this issue: #36814 related to accepted characters. Actually this is my first Pull Request. Please tell me if I did something wrong.
There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look
We can update this Validate message:
From : Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & and be less than 150 characters long.
to
Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & < > and be less than 150 characters long.
What do you think @brianteeman ?
There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look
We can update this Validate message knowing that < > are also not permitted to be used:
From : Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & and be less than 150 characters long.
to
Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & < > and be less than 150 characters long.
What do you think @brianteeman ?
| Title |
|
||||||
This pull request has conflicts, please resolve those before we can evaluate the pull request.
| Labels |
Added:
Conflicting Files
PR-5.4-dev
|
||
| Labels |
Removed:
Conflicting Files
|
||
please use modern code
Hello @alikon , sorry if I missed something. This is my first Request Pull. I just wanted to change in this file: libraries/src/Table/User.php
preg_match('#[<>"'%;()&\\]|\.\./#', $this->username)
to
preg_match('#[\s<>"'%;()&\\]|\.\./#', $this->username)
Sorry for this mess, please tell me what I have to do? Close this pull request and do another one?
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-09-26 16:05:09 |
| Closed_By | ⇒ | aboarken |
There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look