Refactored InstallCommand (+ removed localization from InstallCommand, because it doesn't works actually)
This commit is contained in:
parent
97cd0b5373
commit
0a4636a379
22 changed files with 198 additions and 695 deletions
|
|
@ -61,20 +61,20 @@ class CreateAdminCommand extends Command
|
|||
/** @var $helper QuestionHelper */
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
|
||||
$question = new Question(Lang::get('enter_email'));
|
||||
$question = new Question('Admin email: ');
|
||||
$question->setValidator(function ($answer) {
|
||||
if (!filter_var($answer, FILTER_VALIDATE_EMAIL)) {
|
||||
throw new \InvalidArgumentException(Lang::get('must_be_valid_email'));
|
||||
throw new \InvalidArgumentException('Must be a valid email address.');
|
||||
}
|
||||
|
||||
return $answer;
|
||||
});
|
||||
$adminEmail = $helper->ask($input, $output, $question);
|
||||
|
||||
$question = new Question(Lang::get('enter_name'));
|
||||
$question = new Question('Admin name: ');
|
||||
$adminName = $helper->ask($input, $output, $question);
|
||||
|
||||
$question = new Question(Lang::get('enter_password'));
|
||||
$question = new Question('Admin password: ');
|
||||
$question->setHidden(true);
|
||||
$question->setHiddenFallback(false);
|
||||
|
||||
|
|
@ -82,9 +82,9 @@ class CreateAdminCommand extends Command
|
|||
|
||||
try {
|
||||
$userService->createUser($adminName, $adminEmail, $adminPass, true);
|
||||
$output->writeln(Lang::get('user_created'));
|
||||
$output->writeln('<info>User account created!</info>');
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln(sprintf('<error>%s</error>', Lang::get('failed_to_create')));
|
||||
$output->writeln(sprintf('<error>%s</error>', 'PHP Censor failed to create your admin account.'));
|
||||
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue