fix login logic
authorStricted <info@stricted.net>
Sat, 17 Jun 2017 13:18:29 +0000 (15:18 +0200)
committerStricted <info@stricted.net>
Sat, 17 Jun 2017 13:18:29 +0000 (15:18 +0200)
lib/trait/Login.class.php

index 0bb3045e40637faac303f8e50e2dc1d27767f3b6..737106c5042e6318f80b20aff9f255e9bf752336 100644 (file)
@@ -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])) {