[Done] init|sync works

This commit is contained in:
xdrm-brackets 2017-02-19 12:33:19 +01:00
parent 6b2422ee13
commit e648656881
1 changed files with 17 additions and 3 deletions

View File

@ -301,11 +301,25 @@
->whereUnlockCode($unlock_code)
->fetch();
var_dump($machine);
/* (2) On vérifie si on a bien le bon code */
if( $machine === false )
return false;
/* [2] Si le code est bon, on le supprime et on met le token
=========================================================*/
/* (1) Update (edit) machine */
$updated = Table::get('machine')
->whereId($id_machine)
->whereIdWarehouse($id_warehouse)
->edit([
'unlock_code' => null,
'token' => $first_token
]);
/* (2) Manage edition error */
return $updated;
}
@ -322,7 +336,7 @@
public static function checkToken($id_warehouse, $token, $newToken=null){
/* [1] On vérifie le token
=========================================================*/
$hash = secure_hash($token);
$hash = secure_hash($token, '');
$byToken = self::getByToken($id_warehouse, $hash);