Skip to content

Commit

Permalink
Minor bug fix #17.
Browse files Browse the repository at this point in the history
  • Loading branch information
tertek committed Feb 26, 2024
1 parent a8f01e2 commit fe913f8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions deviceTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,18 @@ private function ajax_validateDevice($payload){
return array("validation_message" => "Device is not available.");
}

$suspension_date = strtotime(reset($device)["device_suspension_date"]);
if( $suspension_date < time()) {
return array("validation_message" => "Device (ID:".$device_id.") has been suspended: " . reset($device)["device_suspension_date"]);
// Check if suspension date was set and invalidated when suspension time has passed
$suspension_date = reset($device)["device_suspension_date"];

if(!empty($suspension_date)){
$suspension_date_time = strtotime(reset($device)["device_suspension_date"]);
if( $suspension_date_time < time()) {
return array("validation_message" => "Device (ID:".$device_id.") has been suspended: " . $suspension_date);
}
}

if(isset($device) && ($suspension_date > time())) {
// return device_id in case the device is valid
if(isset($device)) {
return array("device_id" => $device_id);
}

Expand Down

0 comments on commit fe913f8

Please sign in to comment.