From 2177fa0a9cd4b782f7a40cd8c3d5d2811293c39e Mon Sep 17 00:00:00 2001 From: Noe GARNIER Date: Mon, 28 Nov 2022 10:12:07 +0100 Subject: [PATCH] =?UTF-8?q?Test=20de=20d=C3=A9ploiment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEB/Controller/FrontController.php | 2 +- WEB/Controller/UserController.php | 5 +++-- WEB/Controller/UtilisateurGateway.php | 2 +- WEB/Model/Utilisateur.php | 22 ---------------------- 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/WEB/Controller/FrontController.php b/WEB/Controller/FrontController.php index 63c0cc00..8870beaf 100644 --- a/WEB/Controller/FrontController.php +++ b/WEB/Controller/FrontController.php @@ -3,7 +3,7 @@ class FrontController { function __construct() { - global $rep, $vues; + global $rep, $vues, $error; session_start(); // $role=$_SESSION['role']; // $action=$_REQUEST['action']; diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index 67de1394..8cea6b3c 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -7,7 +7,7 @@ class UserController function __construct() { try{ global $dsn, $rep, $vues, $error; - echo "userController"; + echo "UserController"; $this->con=new Connection ($dsn); echo "USconection"; $action=$_REQUEST['action']; @@ -71,7 +71,8 @@ class UserController throw (new Exception("Email déjà utilisé")); } $password = password_hash($_REQUEST['password'], PASSWORD_DEFAULT); - $Utilisateur = new Utilisateur($_REQUEST['email'], $_REQUEST['username'], $password); + $estAdmin = $gateway->getEstAdminByEmail($_REQUEST['email']); + $Utilisateur = new Utilisateur($_REQUEST['email'], $_REQUEST['username'], $password, $estAdmin); $gateway->insert($Utilisateur); $_SESSION['connected'] = 'true'; $_SESSION['role'] = 'utilisateur'; diff --git a/WEB/Controller/UtilisateurGateway.php b/WEB/Controller/UtilisateurGateway.php index 908d92fb..9392ca3f 100644 --- a/WEB/Controller/UtilisateurGateway.php +++ b/WEB/Controller/UtilisateurGateway.php @@ -51,7 +51,7 @@ class UtilisateurGateway if ($results == null){ return new Utilisateur("null", "null", "null", false); } - return new Utilisateur($email, $pseudo, $mdp, $estAdmin,false); + return new Utilisateur($email, $pseudo, $mdp, $estAdmin); } public function getMdpByEmail(string $email) : string{ diff --git a/WEB/Model/Utilisateur.php b/WEB/Model/Utilisateur.php index b77d042b..8cc430a0 100644 --- a/WEB/Model/Utilisateur.php +++ b/WEB/Model/Utilisateur.php @@ -13,20 +13,12 @@ class Utilisateur * @param string $mdp * @param bool $estAdmin */ -<<<<<<< HEAD public function __construct(string $email, string $pseudo, string $mdp, bool $estAdmin) -======= - public function __construct(string $email, string $pseudo, string $mdp ,bool $estAdmin) ->>>>>>> d82ece50 (Changement de joueur et admin) { $this->email = $email; $this->pseudo = $pseudo; $this->mdp = $mdp; -<<<<<<< HEAD $this->estAdmin = $estAdmin; -======= - $this->estAdmin=$estAdmin; ->>>>>>> d82ece50 (Changement de joueur et admin) } /** @@ -78,31 +70,17 @@ class Utilisateur } /** -<<<<<<< HEAD - * @return bool -======= * @param bool $estAdmin ->>>>>>> d82ece50 (Changement de joueur et admin) */ public function getEstAdmin(): bool { return $this->estAdmin; } -<<<<<<< HEAD /** * @param bool $estAdmin */ public function setEstAdmin(bool $estAdmin): void { $this->estAdmin = $estAdmin; -======= - - /** - * @param bool $estAdmin - */ - public function setEstAdmin(bool $estAdmin) - { - $this->estAdmin=$estAdmin; ->>>>>>> d82ece50 (Changement de joueur et admin) } } \ No newline at end of file