API security update
This commit is contained in:
@@ -34,14 +34,14 @@ if (!empty($username) && !empty($password)) {
|
||||
http_response_code(401);
|
||||
}
|
||||
else {
|
||||
$service = $row['service'];
|
||||
|
||||
$service = bin2hex(random_bytes(25)); //$row['service'];
|
||||
$jwt = createCommunicationToken($service);
|
||||
|
||||
$logindate = date('Y-m-d H:i:s');
|
||||
$id = $row['id'];
|
||||
|
||||
$sql1 = "UPDATE users SET lastlogin = '$logindate' WHERE id='$id'";
|
||||
$sql1 = "UPDATE users SET lastlogin = '$logindate', service = '$service' WHERE id='$id'";
|
||||
$conn->query($sql1);
|
||||
|
||||
echo json_encode(array('token' => $jwt));
|
||||
|
||||
Reference in New Issue
Block a user