Correction 'Authentification.php'
This commit is contained in:
parent
9ef1f25a3a
commit
d12148e809
|
@ -110,12 +110,12 @@
|
|||
/* (1) Si le token n'existe pas, on retourne une erreur */
|
||||
if( $checkBranch->answer() == false )
|
||||
return false;
|
||||
|
||||
|
||||
/* (2) On met à jour les informations de l'administrateur */
|
||||
$_SESSION['ADMIN'] = [
|
||||
'id' => (int) $checkBranch->answer()[0]['id_admin'],
|
||||
'username' => $checkBranch->answer()[0]['username'],
|
||||
'mail' => $checkBranch->answer()[0]['mail']
|
||||
'id' => (int) $checkBranch->answer()['id_admin'],
|
||||
'username' => $checkBranch->answer()['username'],
|
||||
'mail' => $checkBranch->answer()['mail']
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
public static function admin($params){
|
||||
extract($params);
|
||||
|
||||
|
||||
/* [0] Par défaut, on déconnecte l'administrateur
|
||||
=========================================================*/
|
||||
$_SESSION['AUTH'][1] = '';
|
||||
|
@ -89,7 +88,7 @@
|
|||
$usernameFetched = $getUsername->answer();
|
||||
|
||||
// Si aucun résultat, on retourne le status FALSE
|
||||
if( count($usernameFetched) == 0 )
|
||||
if( $usernameFetched === false )
|
||||
return [ 'status' => false ];
|
||||
|
||||
|
||||
|
@ -98,13 +97,13 @@
|
|||
$hash_password = sessionManager::secure_hash($password);
|
||||
|
||||
// Si mot de passe faux, on retourne le status FALSE
|
||||
if( $usernameFetched[0]['password'] != $hash_password )
|
||||
if( $usernameFetched['password'] != $hash_password )
|
||||
return [ 'status' => false ];
|
||||
|
||||
|
||||
/* [3] On définit le token
|
||||
=========================================================*/
|
||||
$_SESSION['AUTH'][1] = $usernameFetched[0]['token'];
|
||||
$_SESSION['AUTH'][1] = $usernameFetched['token'];
|
||||
|
||||
|
||||
// On retourne le status
|
||||
|
|
Loading…
Reference in New Issue