diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index 368f06cba8572c450acf0857a16eb8c90cfee73e..8dd25a7f29739ef76386d1bf3c2f7923f44f7b4d 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 cf8c894d7a7942933dfa7572591b90bdaf558494..3388ef6a1bdaebb8a5a230990072a36162e9c059 100644 --- a/core/Command/User/ResetPassword.php +++ b/core/Command/User/ResetPassword.php @@ -100,7 +100,7 @@ class ResetPassword extends Command { $question->setHidden(true); $password = $helper->ask($input, $output, $question); - $question = new Question('Conform the new password: '); + $question = new Question('Confirm the new password: '); $question->setHidden(true); $confirm = $helper->ask($input, $output, $question); @@ -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 {