From: Stricted Date: Sat, 17 Jun 2017 13:18:29 +0000 (+0200) Subject: fix login logic X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a2bacc49116d44aee2c3d294dbfa8985a06b4a62;p=GitHub%2FStricted%2Fspeedport-hybrid-php-api.git fix login logic --- diff --git a/lib/trait/Login.class.php b/lib/trait/Login.class.php index 0bb3045..737106c 100644 --- a/lib/trait/Login.class.php +++ b/lib/trait/Login.class.php @@ -49,8 +49,7 @@ trait Login { $fields = array('csrf_token' => 'nulltoken', "challengev" => $this->challenge, 'showpw' => 0, 'password' => $this->hash); $data = $this->sendRequest($path, $fields); $json = $this->getValues($data['body']); - - if (in_array("challenge", $json)) { + if (!in_array("challenge", $json)) { $fields = array('csrf_token' => 'nulltoken', 'showpw' => 0, 'password' => $this->hash); $data = $this->sendRequest($path, $fields); $json = $this->getValues($data['body']); @@ -93,10 +92,9 @@ trait Login { * Requests the password-challenge from the router. */ private function getChallenge () { - $path = 'html/content/overview/index.html'; + $path = 'html/login/index.html'; $fields = array(); - $data = $this->sendRequest($path, $fields, true); - + $data = $this->sendRequest($path, $fields); $a = explode('challenge = "', $data['body']); if (!isset($a[1])) {