Browse Source
Catch the exception of the password policy app
pull/1297/head
Joas Schilling
9 years ago
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with
18 additions and
5 deletions
-
core/Command/User/Add.php
-
core/Command/User/ResetPassword.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>'); |
|
|
|
|
|
|
|
@ -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 { |
|
|
|
|