Fixed `AuthSystemDefault` through repo `machine/checkToken` to return MACHINE ID (as for WAREHOUSE/ADMIN session data) + fixed code
This commit is contained in:
parent
fa0b0a956e
commit
26b82ecf94
|
@ -142,13 +142,12 @@
|
|||
$checkBranch = new Repo('machine/checkToken', [ $_SESSION['WAREHOUSE']['id'], $_SESSION['AUTH'][1], $_SESSION['AUTH'][2] ]);
|
||||
|
||||
/* (1) Si le token n'est pas valide, on retourne une erreur */
|
||||
if( $checkBranch->answer() == false )
|
||||
if( $checkBranch->answer() === false )
|
||||
return false;
|
||||
|
||||
/* (2) On met à jour les informations de l'administrateur */
|
||||
$_SESSION['SATS'] = [
|
||||
'id' => (int) $checkBranch->answer()['id_machine'],
|
||||
'name' => $checkBranch->answer()['name']
|
||||
'id' => (int) $checkBranch->answer()
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -614,17 +614,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -672,17 +661,14 @@
|
|||
'id_machine' => $_SESSION['SATS']['id']
|
||||
]);
|
||||
|
||||
var_dump('req', $log_req->error->get());
|
||||
// {2} Manage error //
|
||||
if( $log_req->error->get() != Err::Success )
|
||||
continue;
|
||||
|
||||
// {3} Process + get response //
|
||||
// {2} Process + get response //
|
||||
$log_res = $log_req->dispatch();
|
||||
var_dump('res', $log_res->error->get());
|
||||
|
||||
// {4} Register if success //
|
||||
if( $log_res->error->get() == Err::Success )
|
||||
// {3} Exit on failure //
|
||||
if( $log_res->error->get() != Err::Success )
|
||||
break;
|
||||
|
||||
// {4} Register count if success //
|
||||
$fetched['history']++;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@
|
|||
* @token<String> Token de synchronisation
|
||||
* @newToken<String> Nouveau token de synchronisation (optionnel, uniquement quand on arrive à la fin du cycle de la hashChain)
|
||||
*
|
||||
* @return status<Boolean> VRAI si le token est correct, sinon FALSE
|
||||
* @return machine_id<int> ID de la machine si correct, sinon FALSE
|
||||
*
|
||||
*/
|
||||
public static function checkToken($id_warehouse, $token, $newToken=null){
|
||||
|
@ -400,7 +400,10 @@
|
|||
|
||||
/* [3] On retourne que tout s'est bien déroulé
|
||||
=========================================================*/
|
||||
return $updated;
|
||||
if( !$updated )
|
||||
return false;
|
||||
|
||||
return $byToken['id_machine'];
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue