From 3b0c9ff4ca5b5574a564cba0c79c70ebede7a421 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 29 Dec 2021 02:11:10 +0100 Subject: [PATCH] Fix user login --- config/packages/framework.yaml | 10 +++++--- src/Controller/Admin/DashboardController.php | 2 +- src/Controller/Admin/UserCrudController.php | 26 ++++++++++++++------ src/Controller/TestController.php | 2 +- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 5264885..d610d3c 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -7,10 +7,12 @@ framework: # Enables session support. Note that the session will ONLY be started if you read or write from it. # Remove or comment this section to explicitly disable session support. session: - handler_id: null - cookie_secure: auto - cookie_samesite: lax - storage_factory_id: session.storage.factory.native + handler_id: session.handler.native_file + save_path: '%kernel.project_dir%/var/sessions' +# handler_id: null +# cookie_secure: auto +# cookie_samesite: lax +# storage_factory_id: session.storage.factory.native #esi: true #fragments: true diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index dae473b..24ce68e 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -31,7 +31,7 @@ class DashboardController extends AbstractDashboardController public function configureMenuItems(): iterable { -// yield MenuItem::linktoRoute('Back to home', 'fas fa-home', 'home'); + yield MenuItem::linktoRoute('Back to home', 'fas fa-home', 'home'); yield MenuItem::section('Products', 'fas fa-folder-open'); yield MenuItem::linkToDashboard('Dashboard', 'fa fa-home'); diff --git a/src/Controller/Admin/UserCrudController.php b/src/Controller/Admin/UserCrudController.php index 1575931..86658c7 100644 --- a/src/Controller/Admin/UserCrudController.php +++ b/src/Controller/Admin/UserCrudController.php @@ -3,7 +3,13 @@ namespace App\Controller\Admin; use App\Entity\User; +use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField; +use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField; +use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; +use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField; +use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; class UserCrudController extends AbstractCrudController { @@ -12,14 +18,20 @@ class UserCrudController extends AbstractCrudController return User::class; } - /* public function configureFields(string $pageName): iterable { - return [ - IdField::new('id'), - TextField::new('title'), - TextEditorField::new('description'), - ]; + $fields = []; + + switch ($pageName) { + case Crud::PAGE_INDEX: + case Crud::PAGE_DETAIL: + $fields[] = IdField::new('id'); + } + + $fields[] = TextField::new('username'); + $fields[] = ArrayField::new('roles'); + + return $fields; } - */ + } diff --git a/src/Controller/TestController.php b/src/Controller/TestController.php index d9f32eb..9de7a09 100644 --- a/src/Controller/TestController.php +++ b/src/Controller/TestController.php @@ -14,7 +14,7 @@ class TestController extends AbstractController return $this->render('base/base.html.twig'); } - #[Route('/')] + #[Route('/', name: 'home')] public function home() { return $this->render('base/base.html.twig');