diff options
author | kondou <kondou@ts.unde.re> | 2014-05-13 15:56:25 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2014-05-13 15:57:41 +0200 |
commit | f75c863257e32b19e7e18be5019a983ac5df8232 (patch) | |
tree | 7b9d6bbd5f8fb22fe27ae30e8a92f6fb7a8cc120 /core/command | |
parent | 2a5e1a188508b66f8b4e363382c3f789c3adc1a4 (diff) | |
download | nextcloud-server-f75c863257e32b19e7e18be5019a983ac5df8232.tar.gz nextcloud-server-f75c863257e32b19e7e18be5019a983ac5df8232.zip |
Add doc, check return-value, fix spacing, require interactive
Diffstat (limited to 'core/command')
-rw-r--r-- | core/command/resetpassword.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/core/command/resetpassword.php b/core/command/resetpassword.php index 1dca7c5ee83..1580bdffa5f 100644 --- a/core/command/resetpassword.php +++ b/core/command/resetpassword.php @@ -29,24 +29,33 @@ class ResetPassword extends Command { protected function execute(InputInterface $input, OutputInterface $output) { $username = $input->getArgument('user'); if ($input->isInteractive()) { + /** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */ $dialog = $this->getHelperSet()->get('dialog'); $password = $dialog->askHiddenResponse( $output, '<question>Enter a new password: </question>', false ); + /** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */ $dialog = $this->getHelperSet()->get('dialog'); $confirm = $dialog->askHiddenResponse( $output, - '<question>Confirm the new password: </question>', + '<question>Confirm the new password: </question>', false ); - } - if ($password === $confirm) { - \OC_User::setPassword($username, $password); - $output->writeln("Successfully reset password for " . $username); + + if ($password === $confirm) { + $success = \OC_User::setPassword($username, $password); + if ($success) { + $output->writeln("Successfully reset password for " . $username); + } else { + $output->writeln("There is no user called " . $username); + } + } else { + $output->writeln("Passwords did not match!"); + } } else { - $output->writeln("Passwords did not match!"); + $output->writeln("Interactive input is needed for entering a new password!"); } } } |