diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index 368f06cba8..8dd25a7f29 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('' . $e->getMessage() . ''); + return 1; + } + if ($user instanceof IUser) { $output->writeln('The user "' . $user->getUID() . '" was created successfully'); diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php index cf8c894d7a..62c4eceeee 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('' . $e->getMessage() . ''); + return 1; + } + if ($success) { $output->writeln("Successfully reset password for " . $username . ""); } else {