Classes/Console/Command/BackendCommandController.php
public function createAdminCommand(string $username, string $password)
    {
        $givenUsername = $username;
        $username = strtolower(preg_replace('/\\s/i', '', $username));

        if ($givenUsername !== $username) {
            $this->outputLine('<warning>Given username "%s" contains invalid characters. Using "%s" instead.</warning>', [$givenUsername, $username]);
        }

        if (strlen($username) < 4) {
            $this->outputLine('<error>Username must be at least 4 characters.</error>');
            $this->quit(1);
        }
        if (strlen($password) < 8) {
            $this->outputLine('<error>Password must be at least 8 characters.</error>');
            $this->quit(1);
        }
        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
        $userExists = $connectionPool->getConnectionForTable('be_users')
            ->count(
                'uid',
                'be_users',
                ['username' => $username]
            );
        if ($userExists) {
            $this->outputLine('<error>A user with username "%s" already exists.</error>', [$username]);
            $this->quit(1);
        }
        $adminUserFields = [
            'username' => $username,
            'password' => $this->salt->getHashedPassword($password),
            'admin' => 1,
            'tstamp' => $GLOBALS['EXEC_TIME'],
            'crdate' => $GLOBALS['EXEC_TIME'],
        ];
        $connectionPool->getConnectionForTable('be_users')
            ->insert('be_users', $adminUserFields);

        $this->outputLine('<info>Created admin user with username "%s".</info>', [$username]);
    }
public function createAdminCommand(string $username, string $password)
    {
        $givenUsername = $username;
        $username = strtolower(preg_replace('/\\s/i', '', $username));

        if ($givenUsername !== $username) {
            $this->outputLine('<warning>Given username "%s" contains invalid characters. Using "%s" instead.</warning>', [$givenUsername, $username]);
        }

        if (strlen($username) < 4) {
            $this->outputLine('<error>Username must be at least 4 characters.</error>');
            $this->quit(1);
        }
        if (strlen($password) < 8) {
            $this->outputLine('<error>Password must be at least 8 characters.</error>');
            $this->quit(1);
        }
        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
        $userExists = $connectionPool->getConnectionForTable('be_users')
            ->count(
                'uid',
                'be_users',
                ['username' => $username]
            );
        if ($userExists) {
            $this->outputLine('<error>A user with username "%s" already exists.</error>', [$username]);
            $this->quit(1);
        }
        $adminUserFields = [
            'username' => $username,
            'password' => $this->salt->getHashedPassword($password),
            'admin' => 1,
            'tstamp' => $GLOBALS['EXEC_TIME'],
            'crdate' => $GLOBALS['EXEC_TIME'],
        ];
        $connectionPool->getConnectionForTable('be_users')
            ->insert('be_users', $adminUserFields);

        $this->outputLine('<info>Created admin user with username "%s".</info>', [$username]);
    }
Create admin backend user

Create a new user with administrative access.

@param string $username Username of the user
@param string $password Password of the user