[TASK] Harmonize allowed characters of backend usernames 11/37111/2
authorSascha Egerer <sascha.egerer@dkd.de>
Mon, 23 Feb 2015 11:44:19 +0000 (12:44 +0100)
committerSascha Egerer <sascha@sascha-egerer.de>
Wed, 25 Feb 2015 08:03:17 +0000 (09:03 +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

Resolves: #65224
Releases: master, 6.2
Change-Id: I0edabd2cb82dc59bdc52dd385c1e198f04be6017
Reviewed-on: http://review.typo3.org/37111
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php

index 3c0d78b..d79859e 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', '', $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');
                                $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');
-                               $message->setTitle('Administrator created');
+                               $message->setTitle('Administrator with username "' . $username . '".');
                        }
                }