summaryrefslogtreecommitdiffstats
path: root/core/Command/User
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-07 09:28:42 +0200
committerJoas Schilling <coding@schilljs.com>2016-09-07 09:28:42 +0200
commitc0ecdf640203673801b01c9af0809c4ae87dc60a (patch)
tree0640e6aac7b31606e366572059ce17a61fe5ee4f /core/Command/User
parent0027304b5fc0a92106dca948b72b6fad04b91299 (diff)
downloadnextcloud-server-c0ecdf640203673801b01c9af0809c4ae87dc60a.tar.gz
nextcloud-server-c0ecdf640203673801b01c9af0809c4ae87dc60a.zip
Catch the exception of the password policy app
Diffstat (limited to 'core/Command/User')
-rw-r--r--core/Command/User/Add.php14
-rw-r--r--core/Command/User/ResetPassword.php9
2 files changed, 18 insertions, 5 deletions
diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php
index 368f06cba85..8dd25a7f297 100644
--- a/core/Command/User/Add.php
+++ b/core/Command/User/Add.php
@@ -115,10 +115,16 @@ class Add extends Command {
return 1;
}
- $user = $this->userManager->createUser(
- $input->getArgument('uid'),
- $password
- );
+ try {
+ $user = $this->userManager->createUser(
+ $input->getArgument('uid'),
+ $password
+ );
+ } catch (\Exception $e) {
+ $output->writeln('<error>' . $e->getMessage() . '</error>');
+ return 1;
+ }
+
if ($user instanceof IUser) {
$output->writeln('<info>The user "' . $user->getUID() . '" was created successfully</info>');
diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php
index cf8c894d7a7..62c4eceeee2 100644
--- a/core/Command/User/ResetPassword.php
+++ b/core/Command/User/ResetPassword.php
@@ -113,7 +113,14 @@ class ResetPassword extends Command {
return 1;
}
- $success = $user->setPassword($password);
+
+ try {
+ $success = $user->setPassword($password);
+ } catch (\Exception $e) {
+ $output->writeln('<error>' . $e->getMessage() . '</error>');
+ return 1;
+ }
+
if ($success) {
$output->writeln("<info>Successfully reset password for " . $username . "</info>");
} else {