diff --git a/libraries/src/Console/AddUserCommand.php b/libraries/src/Console/AddUserCommand.php index 578b46fa79ddf..6135830ec5541 100644 --- a/libraries/src/Console/AddUserCommand.php +++ b/libraries/src/Console/AddUserCommand.php @@ -167,6 +167,9 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in case "JLIB_DATABASE_ERROR_VALID_MAIL": $this->ioStyle->error("The email address is invalid!"); break; + case "JLIB_DATABASE_ERROR_VALID_AZ09": + $this->ioStyle->error("The username is invalid!"); + break; } return 1; diff --git a/libraries/src/Table/User.php b/libraries/src/Table/User.php index 74796b681cb24..e95108092aba3 100644 --- a/libraries/src/Table/User.php +++ b/libraries/src/Table/User.php @@ -217,7 +217,7 @@ public function check() } if ( - preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $this->username) || StringHelper::strlen($this->username) < 2 + preg_match('#[\s<>"\'%;()&\\\\]|\\.\\./#', $this->username) || StringHelper::strlen($this->username) < 2 || $filterInput->clean($this->username, 'TRIM') !== $this->username || StringHelper::strlen($this->username) > 150 ) { $this->setError(Text::sprintf('JLIB_DATABASE_ERROR_VALID_AZ09', 2));