Skip to content

Commit

Permalink
Added more simple fos:user:create command to update or create admin user
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Nov 24, 2019
1 parent 36dbd7c commit ade208f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Packagist/WebBundle/Command/CreateUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->userManipulator->changePassword($username, $password);
}

$output->writeln("User $username was updated successfully");
return;
}

$password = $input->getOption('password') ?: $username;
$email = $input->getOption('email') ?: $username . '@example.com';
$this->userManipulator->create($username, $password, $email, true, $input->getOption('admin'));
$this->userManipulator->addRole($username, 'ROLE_ADMIN');

$output->writeln("User $username was created successfully");
}
}

0 comments on commit ade208f

Please sign in to comment.