|
|
@ -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';
|
|
|
|