From 515235163c935c5e9f45513028f1e83444010015 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 23 Mar 2022 18:44:16 +0100 Subject: Allow app passwords without login password for occ user:add-app-password Signed-off-by: Christoph Wurst --- core/Command/User/AddAppPassword.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'core') diff --git a/core/Command/User/AddAppPassword.php b/core/Command/User/AddAppPassword.php index 7a2270e20b1..65b572533f5 100644 --- a/core/Command/User/AddAppPassword.php +++ b/core/Command/User/AddAppPassword.php @@ -1,4 +1,7 @@ getArgument('user'); + $password = null; $user = $this->userManager->get($username); if (is_null($user)) { @@ -98,18 +105,13 @@ class AddAppPassword extends Command { $question = new Question('Enter the user password: '); $question->setHidden(true); + /** @var null|string $password */ $password = $helper->ask($input, $output, $question); - - if ($password === null) { - $output->writeln("Password cannot be empty!"); - return 1; - } - } else { - $output->writeln("Interactive input or --password-from-env is needed for entering a new password!"); - return 1; } - $output->writeln('The password has not been validated, some features might not work as intended.'); + if ($password === null) { + $output->writeln('No password provided. The generated app password will therefore have limited capabilities. Any operation that requires the login password will fail.'); + } $token = $this->random->generate(72, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); $generatedToken = $this->tokenProvider->generateToken( -- cgit v1.2.3