ajouter isAdmin et isLogged aux sessions

php
Gwenael PLANCHON 1 year ago
parent 5cdc0e6ddc
commit 5078d4a91a

@ -77,14 +77,16 @@ class FrontController
$ug = new MdlUser(); $ug = new MdlUser();
if($ug->login($_REQUEST['login'], $_REQUEST['password'])) { if($ug->login($_REQUEST['login'], $_REQUEST['password'])) {
$_SESSION['pseudo'] = $_REQUEST['login']; $_SESSION['pseudo'] = $_REQUEST['login'];
$_SESSION['isLogged'] = true;
header("Location: ."); header("Location: .");
} else { } else {
//todo : verifier si utilisateur existe dans User ou Admin au lieu de login les 2 a la fois
//voir si c'est un admin //voir si c'est un admin
$ug = new MdlAdmin(); $ug = new MdlAdmin();
if($ug->login($_REQUEST['login'], $_REQUEST['password'])) { if($ug->login($_REQUEST['login'], $_REQUEST['password'])) {
$_SESSION['pseudo'] = $_REQUEST['login']; $_SESSION['pseudo'] = $_REQUEST['login'];
header("Location: ."); $_SESSION['isAdmin'] = true;
$_SESSION['isLogged'] = true;
header("Location: .");
} else { } else {
$dVueErreur[] = "Connexion échouée"; $dVueErreur[] = "Connexion échouée";
throw new LoginException("Connexion err"); throw new LoginException("Connexion err");

Loading…
Cancel
Save