[Pkg-owncloud-commits] [owncloud] 14/199: Add doc, check return-value, fix spacing, require interactive

David Prévot taffit at moszumanska.debian.org
Sun Jun 1 18:53:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit f75c863257e32b19e7e18be5019a983ac5df8232
Author: kondou <kondou at ts.unde.re>
Date:   Tue May 13 15:56:25 2014 +0200

    Add doc, check return-value, fix spacing, require interactive
---
 core/command/resetpassword.php | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/core/command/resetpassword.php b/core/command/resetpassword.php
index 1dca7c5..1580bdf 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!");
 		}
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list