Update authenticateMe.php
This commit is contained in:
parent
52312f1ecc
commit
2efb8382e7
@ -1,13 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'includes/imp_files.php';
|
require_once '../includes/imp_files.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
$cookie_life_days = COOKIE_LIFE_DAYS;
|
$cookie_life_days = COOKIE_LIFE_DAYS;
|
||||||
|
|
||||||
$std = new stdClass();
|
$std = new stdClass();
|
||||||
$std->message = array();
|
$std->message = array();
|
||||||
$std->error = true;
|
$std->error = true;
|
||||||
|
|
||||||
if (isset($_POST['flo_id'], $_POST['flo_pub_key'], $_SESSION['session_id'], $_POST['signDataWithFlo'] )){
|
if (isset($_POST['floID'], $_POST['floPubKey'], $_SESSION['session_id'], $_POST['signDataWithFlo'] )){
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
@ -43,8 +45,8 @@ $std->error = true;
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$floID = $_POST['flo_id'];
|
$floID = $_POST['floID'];
|
||||||
$pubKey = $_POST['flo_pub_key'];
|
$pubKey = $_POST['floPubKey'];
|
||||||
$s_id = $_SESSION['session_id'];
|
$s_id = $_SESSION['session_id'];
|
||||||
$signDataWithFlo = $_POST['signDataWithFlo'];
|
$signDataWithFlo = $_POST['signDataWithFlo'];
|
||||||
|
|
||||||
@ -76,16 +78,18 @@ $std->error = true;
|
|||||||
//Now I need to enter public key and session ID in database .. but first I need to know the username
|
//Now I need to enter public key and session ID in database .. but first I need to know the username
|
||||||
// This check can be suspended here. If the user has correct FLO signature, but does not exist in database, he will fail the gate at acc_deact.php
|
// This check can be suspended here. If the user has correct FLO signature, but does not exist in database, he will fail the gate at acc_deact.php
|
||||||
if (isset($UserClass)) {
|
if (isset($UserClass)) {
|
||||||
$permitted_status = $UserClass->checkIfFloIDPermitted($flo_id);
|
$permitted_status = $UserClass->checkIfFloIDPermitted($floID);
|
||||||
if ($permitted_status == true){
|
if ($permitted_status == true){
|
||||||
$UserClass->insert_flo_details($floID, $s_id, $pubKey);}
|
$UserClass->update_flo_details($floID, $s_id, $pubKey);
|
||||||
|
$_SESSION['user_id'] = $UserClass->getUserID($floID);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$std->message[] = "FLO ID is either not registered or not active.";
|
$std->message[] = "FLO ID is either not registered or not active.";
|
||||||
$std->error = true;
|
$std->error = true;
|
||||||
echo json_encode($std);
|
echo json_encode($std);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$std->message[] = "Authentication Succeeded.";
|
||||||
$std->error = false;
|
$std->error = false;
|
||||||
echo json_encode($std);
|
echo json_encode($std);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user