diff --git a/api.php b/api.php index 86da9b6..fa62084 100644 --- a/api.php +++ b/api.php @@ -59,7 +59,7 @@ case 'test_auth': if($_SESSION["utilisateur_authentifie"] == true){ - echo(json_encode(["status"=> "1","msg"=> "Utilisateur bien authentifié."])); + echo(json_encode(["status"=> "1","msg"=> "Bonjour ".$_SESSION["unsername"]." !"])); }else{ echo(json_encode(["status"=> "4","msg"=> "Utilisateur non authentifié."])); } diff --git a/js/index.js b/js/index.js index b4b51d4..47d0db1 100644 --- a/js/index.js +++ b/js/index.js @@ -6,11 +6,13 @@ async function test_auth(){ // fonction de test, innutile en prod async function authenticate_user(){ - resp = await fetch("api.php/auth"); + /*resp = await fetch("api.php/auth"); data = await resp.json(); if(data.status == 1){ document.getElementById("user_status").innerText = data["msg"]; - } + }*/ + + document.location.href = "session_verif.php"; } diff --git a/session_verif.php b/session_verif.php index 00ccf48..f1f83f6 100644 --- a/session_verif.php +++ b/session_verif.php @@ -34,6 +34,7 @@ if (isset($_REQUEST['logout'])) { } $_SESSION["utilisateur_authentifie"] = true; +$_SESSION["username"] = phpCAS::getUser(); function verifier_session(){ @@ -41,6 +42,9 @@ function verifier_session(){ //return json_encode(["status"=>1,"msg"=>"Bonjour !"]); } + + +// fermez les yeux ici, j'ai pas la foi de faire un admin panel en entier $ADMINS = array("mougnibas","rebillar"); function admin_seulement(){