aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/User/Add.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command/User/Add.php')
-rw-r--r--core/Command/User/Add.php37
1 files changed, 9 insertions, 28 deletions
diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php
index 3411946fdeb..4de4e247991 100644
--- a/core/Command/User/Add.php
+++ b/core/Command/User/Add.php
@@ -1,28 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Anupam Kumar <kyteinsky@gmail.com>
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Laurens Post <lkpost@scept.re>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Core\Command\User;
@@ -71,7 +52,7 @@ class Add extends Command {
'password-from-env',
null,
InputOption::VALUE_NONE,
- 'read password from environment variable OC_PASS'
+ 'read password from environment variable NC_PASS/OC_PASS'
)
->addOption(
'generate-password',
@@ -110,10 +91,10 @@ class Add extends Command {
// Setup password.
if ($input->getOption('password-from-env')) {
- $password = getenv('OC_PASS');
+ $password = getenv('NC_PASS') ?: getenv('OC_PASS');
if (!$password) {
- $output->writeln('<error>--password-from-env given, but OC_PASS is empty!</error>');
+ $output->writeln('<error>--password-from-env given, but NC_PASS/OC_PASS is empty!</error>');
return 1;
}
} elseif ($input->getOption('generate-password')) {
@@ -133,11 +114,11 @@ class Add extends Command {
$confirm = $helper->ask($input, $output, $question);
if ($password !== $confirm) {
- $output->writeln("<error>Passwords did not match!</error>");
+ $output->writeln('<error>Passwords did not match!</error>');
return 1;
}
} else {
- $output->writeln("<error>Interactive input or --password-from-env or --generate-password is needed for setting a password!</error>");
+ $output->writeln('<error>Interactive input or --password-from-env or --generate-password is needed for setting a password!</error>');
return 1;
}