fix login logic again
[GitHub/Stricted/speedport-hybrid-php-api.git] / lib / trait / Login.class.php
index 737106c5042e6318f80b20aff9f255e9bf752336..bfbb276635c491ecc73d4a9066135c334e79ac1e 100644 (file)
@@ -49,12 +49,11 @@ 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 (array_key_exists("challengev", $json)) {
                        $fields = array('csrf_token' => 'nulltoken', 'showpw' => 0, 'password' => $this->hash);
                        $data = $this->sendRequest($path, $fields);
                        $json = $this->getValues($data['body']);
                }
-               
                if (isset($json['login']) && $json['login'] == 'success') {
                        $this->cookie = $this->getCookie($data);