From 35bd6b8d6a207cc300580748a84a3b58dac3a1d8 Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Wed, 9 Oct 2019 10:53:52 +0200 Subject: [PATCH] Fool proving registration --- api.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api.php b/api.php index f7dc0df..537132c 100644 --- a/api.php +++ b/api.php @@ -104,7 +104,12 @@ if ($token == null || $token == "") { //Vstupní Checky if (!DeviceManager::registeret($token)) { - DeviceManager::create($token, $token); + $deviceId = DeviceManager::create($token, $token); + foreach ($values as $key => $value) { + if (!SubDeviceManager::getSubDeviceByMaster($deviceId, $key)) { + SubDeviceManager::create($deviceId, $key, UNITS[$key]); + } + } header("HTTP/1.1 401 Unauthorized"); echo json_encode(array( 'state' => 'unsuccess',