From 1b794f775d6fd112e5a5fdade2d457b6e7d3613b Mon Sep 17 00:00:00 2001 From: tracer Date: Tue, 25 Oct 2022 15:53:28 +0200 Subject: [PATCH] fixed a wrong named variable --- src/Controller/AddressBookAdminController.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Controller/AddressBookAdminController.php b/src/Controller/AddressBookAdminController.php index 43667e6..b773e3c 100644 --- a/src/Controller/AddressBookAdminController.php +++ b/src/Controller/AddressBookAdminController.php @@ -13,7 +13,6 @@ use App\Entity\User; use App\Service\Router; use App\Service\Template; use App\Repository\UserRepository; -use JetBrains\PhpStorm\NoReturn; class AddressBookAdminController { @@ -39,7 +38,7 @@ class AddressBookAdminController public function admin(): never { - // TODO $this->adminCheck(); + $this->adminCheck(); $this->template->render(templateName: 'admin/index.html.php', vars: [ 'user' => $this->user, 'router' => $this->router @@ -49,7 +48,7 @@ class AddressBookAdminController public function adminUser(): never { - // TODO $this->adminCheck(); + $this->adminCheck(); $users = $this->userRepository->findAll(); @@ -62,7 +61,7 @@ class AddressBookAdminController public function adminUserEdit(array $parameters): never { - // TODO $this->adminCheck(); + $this->adminCheck(); if (!empty($_POST)) { if (!empty($_POST['is_admin'])) { @@ -108,8 +107,7 @@ class AddressBookAdminController // TODO currently breaks on inserting a duplicate nick if (!empty($_POST)) { $isAdmin = empty($_POST['is_admin']) ? 0 : 1; - echo "isA: $isAdmin"; - $user = new User(nick: $_POST['nick'], password: $_POST['password'], first: $_POST['first'], last: $_POST['last'], isAdmin: $isAdmin); + $user = new User(nick: $_POST['nick'], newPassword: $_POST['new_password'], first: $_POST['first'], last: $_POST['last'], isAdmin: $isAdmin); if ($this->userRepository->insert(user: $user)) { $users = $this->userRepository->findAll();