backports murph-skeleton
This commit is contained in:
parent
0b7dbc98d5
commit
581172e7b3
|
@ -229,21 +229,27 @@ tr.table-primary-light {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1080px) {
|
||||||
|
.sidebar-sticky {
|
||||||
|
overflow-y: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 770px) {
|
@media screen and (max-width: 770px) {
|
||||||
.body {
|
.body {
|
||||||
margin-left: 50px;
|
margin-left: 50px;
|
||||||
width: calc(100vw - 50px);
|
width: calc(100vw - 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
width: 50px;
|
|
||||||
max-width: 100% !important;
|
|
||||||
|
|
||||||
.sidebar-sticky {
|
.sidebar-sticky {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
max-width: 100% !important;
|
max-width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
width: 50px;
|
||||||
|
max-width: 100% !important;
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,12 @@ use App\Core\Manager\EntityManager;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||||
use Symfony\Component\Console\Question\Question;
|
use Symfony\Component\Console\Question\Question;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
use Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface;
|
||||||
|
|
||||||
class UserCreateCommand extends Command
|
class UserCreateCommand extends Command
|
||||||
{
|
{
|
||||||
|
@ -18,11 +20,16 @@ class UserCreateCommand extends Command
|
||||||
protected static $defaultDescription = 'Creates a user';
|
protected static $defaultDescription = 'Creates a user';
|
||||||
protected UserFactory $userFactory;
|
protected UserFactory $userFactory;
|
||||||
protected EntityManager $entityManager;
|
protected EntityManager $entityManager;
|
||||||
|
protected TokenGeneratorInterface $tokenGenerator;
|
||||||
|
|
||||||
public function __construct(UserFactory $userFactory, EntityManager $entityManager)
|
public function __construct(
|
||||||
{
|
UserFactory $userFactory,
|
||||||
|
EntityManager $entityManager,
|
||||||
|
TokenGeneratorInterface $tokenGenerator
|
||||||
|
) {
|
||||||
$this->userFactory = $userFactory;
|
$this->userFactory = $userFactory;
|
||||||
$this->entityManager = $entityManager;
|
$this->entityManager = $entityManager;
|
||||||
|
$this->tokenGenerator = $tokenGenerator;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +39,8 @@ class UserCreateCommand extends Command
|
||||||
$this
|
$this
|
||||||
->setDescription(self::$defaultDescription)
|
->setDescription(self::$defaultDescription)
|
||||||
->addArgument('email', InputArgument::OPTIONAL, 'E-mail')
|
->addArgument('email', InputArgument::OPTIONAL, 'E-mail')
|
||||||
|
->addOption('is-admin', null, InputOption::VALUE_NONE, 'Add the admin role')
|
||||||
|
->addOption('is-writer', null, InputOption::VALUE_NONE, 'Add the write role')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +52,7 @@ class UserCreateCommand extends Command
|
||||||
$emailQuestion = new Question('E-mail: ');
|
$emailQuestion = new Question('E-mail: ');
|
||||||
$emailQuestion->setValidator(function ($value) {
|
$emailQuestion->setValidator(function ($value) {
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
throw new \RuntimeException(
|
throw new \RuntimeException('The email must not be empty.');
|
||||||
'The email must not be empty.'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -53,8 +60,17 @@ class UserCreateCommand extends Command
|
||||||
|
|
||||||
$passwordQuestion = new Question('Password (leave empty to generate a random password): ');
|
$passwordQuestion = new Question('Password (leave empty to generate a random password): ');
|
||||||
$passwordQuestion->setHidden(true);
|
$passwordQuestion->setHidden(true);
|
||||||
$isAdminQuestion = new ConfirmationQuestion('Is admin? [y/n] ', false);
|
|
||||||
$isWriterQuestion = new ConfirmationQuestion('Is writer? [y/n] ', false);
|
$isAdminDefault = $input->getOption('is-admin');
|
||||||
|
$isWriterDefault = $input->getOption('is-writer');
|
||||||
|
|
||||||
|
$isAdminQuestionLabel = sprintf('Administrator [%s] ', $isAdminDefault ? 'Y/n' : 'y/N');
|
||||||
|
$isWriterQuestionLabel = sprintf('Writer [%s] ', $isWriterDefault ? 'Y/n' : 'y/N');
|
||||||
|
|
||||||
|
$isAdminQuestion = new ConfirmationQuestion($isAdminQuestionLabel, $isAdminDefault);
|
||||||
|
$isWriterQuestion = new ConfirmationQuestion($isWriterQuestionLabel, $isWriterDefault);
|
||||||
|
|
||||||
|
$io->section('Authentication');
|
||||||
|
|
||||||
$email = $input->getArgument('email');
|
$email = $input->getArgument('email');
|
||||||
|
|
||||||
|
@ -63,6 +79,18 @@ class UserCreateCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$password = $helper->ask($input, $output, $passwordQuestion);
|
$password = $helper->ask($input, $output, $passwordQuestion);
|
||||||
|
|
||||||
|
$showPassword = empty($password);
|
||||||
|
|
||||||
|
if ($showPassword) {
|
||||||
|
$password = mb_substr($this->tokenGenerator->generateToken(), 0, 18);
|
||||||
|
$io->info(sprintf('Password: %s', $password));
|
||||||
|
} else {
|
||||||
|
$io->newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
$io->section('Roles');
|
||||||
|
|
||||||
$isAdmin = $helper->ask($input, $output, $isAdminQuestion);
|
$isAdmin = $helper->ask($input, $output, $isAdminQuestion);
|
||||||
$isWriter = $helper->ask($input, $output, $isWriterQuestion);
|
$isWriter = $helper->ask($input, $output, $isWriterQuestion);
|
||||||
|
|
||||||
|
@ -72,6 +100,7 @@ class UserCreateCommand extends Command
|
||||||
|
|
||||||
$this->entityManager->create($user);
|
$this->entityManager->create($user);
|
||||||
|
|
||||||
|
$io->newLine();
|
||||||
$io->success('User created!');
|
$io->success('User created!');
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
|
|
|
@ -16,9 +16,8 @@ class UserFactory implements FactoryInterface
|
||||||
protected TokenGeneratorInterface $tokenGenerator;
|
protected TokenGeneratorInterface $tokenGenerator;
|
||||||
protected UserPasswordEncoderInterface $encoder;
|
protected UserPasswordEncoderInterface $encoder;
|
||||||
|
|
||||||
public function __construct(TokenGeneratorInterface $tokenGenerator, UserPasswordEncoderInterface $encoder)
|
public function __construct(UserPasswordEncoderInterface $encoder)
|
||||||
{
|
{
|
||||||
$this->tokenGenerator = $tokenGenerator;
|
|
||||||
$this->encoder = $encoder;
|
$this->encoder = $encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,14 +25,13 @@ class UserFactory implements FactoryInterface
|
||||||
{
|
{
|
||||||
$entity = new User();
|
$entity = new User();
|
||||||
|
|
||||||
if (!empty($email)) {
|
if (null !== $email) {
|
||||||
$entity->setEmail($email);
|
$entity->setEmail($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
$entity->setPassword($this->encoder->encodePassword(
|
if (null !== $email) {
|
||||||
$entity,
|
$entity->setPassword($this->encoder->encodePassword($entity, $password));
|
||||||
!empty($password) ? $password : $this->tokenGenerator->generateToken()
|
}
|
||||||
));
|
|
||||||
|
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<div class="d-none d-md-block">
|
<div class="d-none d-lg-block">
|
||||||
{% if node.page %}
|
{% if node.page %}
|
||||||
<a href="{{ path('admin_site_page_edit', {entity: node.page.id}) }}" class="btn btn-sm btn-warning text-white mr-1 mb-1">
|
<a href="{{ path('admin_site_page_edit', {entity: node.page.id}) }}" class="btn btn-sm btn-warning text-white mr-1 mb-1">
|
||||||
<span class="fa fa-file-alt"></span>
|
<span class="fa fa-file-alt"></span>
|
||||||
|
@ -141,10 +141,8 @@
|
||||||
<button form="form-node-visibility-{{ node.id }}" class="btn btn-sm btn-light border-dark mr-1 mb-1">
|
<button form="form-node-visibility-{{ node.id }}" class="btn btn-sm btn-light border-dark mr-1 mb-1">
|
||||||
{% if node.isVisible %}
|
{% if node.isVisible %}
|
||||||
<span class="fa fa-eye"></span>
|
<span class="fa fa-eye"></span>
|
||||||
{{ 'Visible'|trans }}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="fa fa-eye-slash"></span>
|
<span class="fa fa-eye-slash"></span>
|
||||||
{{ 'Hidden'|trans }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -166,7 +164,7 @@
|
||||||
<span class="fa fa-trash"></span>
|
<span class="fa fa-trash"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-block d-md-none text-left">
|
<div class="d-block d-lg-none text-left">
|
||||||
<button type="button" class="btn btn-sm dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<button type="button" class="btn btn-sm dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
{{ 'Actions'|trans }}
|
{{ 'Actions'|trans }}
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in a new issue