phpcas
This commit is contained in:
parent
8fd771a345
commit
7c43151c1f
3 changed files with 9 additions and 3 deletions
2
api.php
2
api.php
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
case 'test_auth':
|
case 'test_auth':
|
||||||
if($_SESSION["utilisateur_authentifie"] == true){
|
if($_SESSION["utilisateur_authentifie"] == true){
|
||||||
echo(json_encode(["status"=> "1","msg"=> "Utilisateur bien authentifié."]));
|
echo(json_encode(["status"=> "1","msg"=> "Bonjour ".$_SESSION["unsername"]." !"]));
|
||||||
}else{
|
}else{
|
||||||
echo(json_encode(["status"=> "4","msg"=> "Utilisateur non authentifié."]));
|
echo(json_encode(["status"=> "4","msg"=> "Utilisateur non authentifié."]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,13 @@ async function test_auth(){
|
||||||
|
|
||||||
// fonction de test, innutile en prod
|
// fonction de test, innutile en prod
|
||||||
async function authenticate_user(){
|
async function authenticate_user(){
|
||||||
resp = await fetch("api.php/auth");
|
/*resp = await fetch("api.php/auth");
|
||||||
data = await resp.json();
|
data = await resp.json();
|
||||||
if(data.status == 1){
|
if(data.status == 1){
|
||||||
document.getElementById("user_status").innerText = data["msg"];
|
document.getElementById("user_status").innerText = data["msg"];
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
document.location.href = "session_verif.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ if (isset($_REQUEST['logout'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION["utilisateur_authentifie"] = true;
|
$_SESSION["utilisateur_authentifie"] = true;
|
||||||
|
$_SESSION["username"] = phpCAS::getUser();
|
||||||
|
|
||||||
function verifier_session(){
|
function verifier_session(){
|
||||||
|
|
||||||
|
@ -41,6 +42,9 @@ function verifier_session(){
|
||||||
//return json_encode(["status"=>1,"msg"=>"Bonjour !"]);
|
//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");
|
$ADMINS = array("mougnibas","rebillar");
|
||||||
|
|
||||||
function admin_seulement(){
|
function admin_seulement(){
|
||||||
|
|
Loading…
Reference in a new issue