Correction de date d'expiration des tokens (inf OU EGAL a la date d'expiration)
This commit is contained in:
parent
30fea99ed6
commit
ec9d10c71f
|
@ -33,22 +33,14 @@
|
||||||
public static function getAll(){
|
public static function getAll(){
|
||||||
/* [1] On prepare et execute la requete
|
/* [1] On prepare et execute la requete
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$request = Database::getPDO()->query("SELECT id_token as id, name, token, expires
|
$request = Database::getPDO()->query("SELECT id_token as id, name, token, expires, (CURDATE() > expires) as expired
|
||||||
FROM api_token
|
FROM api_token
|
||||||
ORDER BY expires DESC");
|
ORDER BY expires DESC");
|
||||||
|
|
||||||
/* [2] On recupere les donnees et ajout le status d'expire ou non
|
|
||||||
|
/* [3] On retourne les donnees
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$data = Database::delNumeric( $request->fetchAll() );
|
return Database::delNumeric( $request->fetchAll() );
|
||||||
|
|
||||||
// Si le token est expire
|
|
||||||
foreach($data as $i=>$token)
|
|
||||||
$data[$i]['expired'] = time() > strtotime($token['expires']);
|
|
||||||
|
|
||||||
|
|
||||||
/* [3] On retourne le resultat
|
|
||||||
=========================================================*/
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue