Test de déploiment
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent bcded9a6ae
commit 2177fa0a9c

@ -3,7 +3,7 @@ class FrontController
{ {
function __construct() function __construct()
{ {
global $rep, $vues; global $rep, $vues, $error;
session_start(); session_start();
// $role=$_SESSION['role']; // $role=$_SESSION['role'];
// $action=$_REQUEST['action']; // $action=$_REQUEST['action'];

@ -7,7 +7,7 @@ class UserController
function __construct() { function __construct() {
try{ try{
global $dsn, $rep, $vues, $error; global $dsn, $rep, $vues, $error;
echo "userController"; echo "UserController";
$this->con=new Connection ($dsn); $this->con=new Connection ($dsn);
echo "USconection"; echo "USconection";
$action=$_REQUEST['action']; $action=$_REQUEST['action'];
@ -71,7 +71,8 @@ class UserController
throw (new Exception("Email déjà utilisé")); throw (new Exception("Email déjà utilisé"));
} }
$password = password_hash($_REQUEST['password'], PASSWORD_DEFAULT); $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); $gateway->insert($Utilisateur);
$_SESSION['connected'] = 'true'; $_SESSION['connected'] = 'true';
$_SESSION['role'] = 'utilisateur'; $_SESSION['role'] = 'utilisateur';

@ -51,7 +51,7 @@ class UtilisateurGateway
if ($results == null){ if ($results == null){
return new Utilisateur("null", "null", "null", false); 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{ public function getMdpByEmail(string $email) : string{

@ -13,20 +13,12 @@ class Utilisateur
* @param string $mdp * @param string $mdp
* @param bool $estAdmin * @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)
=======
public function __construct(string $email, string $pseudo, string $mdp ,bool $estAdmin)
>>>>>>> d82ece50 (Changement de joueur et admin)
{ {
$this->email = $email; $this->email = $email;
$this->pseudo = $pseudo; $this->pseudo = $pseudo;
$this->mdp = $mdp; $this->mdp = $mdp;
<<<<<<< HEAD
$this->estAdmin = $estAdmin; $this->estAdmin = $estAdmin;
=======
$this->estAdmin=$estAdmin;
>>>>>>> d82ece50 (Changement de joueur et admin)
} }
/** /**
@ -78,31 +70,17 @@ class Utilisateur
} }
/** /**
<<<<<<< HEAD
* @return bool
=======
* @param bool $estAdmin * @param bool $estAdmin
>>>>>>> d82ece50 (Changement de joueur et admin)
*/ */
public function getEstAdmin(): bool public function getEstAdmin(): bool
{ {
return $this->estAdmin; return $this->estAdmin;
} }
<<<<<<< HEAD
/** /**
* @param bool $estAdmin * @param bool $estAdmin
*/ */
public function setEstAdmin(bool $estAdmin): void public function setEstAdmin(bool $estAdmin): void
{ {
$this->estAdmin = $estAdmin; $this->estAdmin = $estAdmin;
=======
/**
* @param bool $estAdmin
*/
public function setEstAdmin(bool $estAdmin)
{
$this->estAdmin=$estAdmin;
>>>>>>> d82ece50 (Changement de joueur et admin)
} }
} }
Loading…
Cancel
Save