[TASK] Harmonize allowed characters of backend usernames 97/35997/3
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 13 Jan 2015 12:41:44 +0000 (13:41 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 31 Jan 2015 13:34:56 +0000 (14:34 +0100)
When creating new backend users from the intall tool, any
character is now accepted for the username. Whitespaces get
trimmed and uppercase is converted to lowercase.
This is already the case for TCA of be_users.username

Change-Id: I0edabd2cb82dc59bdc52dd385c1e198f04be6017
Resolves: #50875
Releases: master
Reviewed-on: http://review.typo3.org/35997
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php

index 2c15e38..e467ec8 100644 (file)
@@ -196,7 +196,7 @@ class ImportantActions extends Action\AbstractAction {
         */
        protected function createAdministrator() {
                $values = $this->postValues['values'];
-               $username = preg_replace('/[^\\da-z._]/i', '', trim($values['newUserUsername']));
+               $username = preg_replace('/\\s/i', '', trim($values['newUserUsername']));
                $password = $values['newUserPassword'];
                $passwordCheck = $values['newUserPasswordCheck'];
 
@@ -226,7 +226,7 @@ class ImportantActions extends Action\AbstractAction {
                                /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
                                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                $message->setTitle('Administrator user not created');
-                               $message->setMessage('A user with username ' . $username . ' exists already.');
+                               $message->setMessage('A user with username "' . $username . '" exists already.');
                        } else {
                                $hashedPassword = $this->getHashedPassword($password);
                                $adminUserFields = array(
@@ -239,7 +239,7 @@ class ImportantActions extends Action\AbstractAction {
                                $database->exec_INSERTquery('be_users', $adminUserFields);
                                /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
                                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
-                               $message->setTitle('Administrator created');
+                               $message->setTitle('Administrator created with username "' . $username . '".');
                        }
                }