diff --git a/lib/login.php b/lib/login.php index 326deae..385f28e 100644 --- a/lib/login.php +++ b/lib/login.php @@ -1,7 +1,7 @@ request('POST', PORTAL_API, [ + 'form_params' => [ + 'key' => $key, + 'action' => "ping" + ] + ]); + + if ($response->getStatusCode() === 200) { + return true; + } + return false; + } catch (Exception $e) { + return false; + } +} + //////////////////////////////////////////////////////////////////////////////// // Account handling // //////////////////////////////////////////////////////////////////////////////// @@ -213,7 +240,7 @@ function doLoginUser($username) { } $resp = json_decode($response->getBody(), TRUE); - + if ($resp['status'] == "OK") { $userinfo = $resp['data']; $_SESSION['username'] = $username;