Ver código fonte

Change behaviour if authorizationToUser is null

authorizationToUser() returns now an empty string by default
If it returns an empty string, conf is set to null and api don't die
anymore.

Fix https://github.com/FreshRSS/FreshRSS/issues/747
Marien Fressinaud 11 anos atrás
pai
commit
e8556ac1a4
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4 4
      p/api/greader.php

+ 4 - 4
p/api/greader.php

@@ -168,7 +168,7 @@ function authorizationToUser() {
 			}
 			}
 		}
 		}
 	}
 	}
-	return null;
+	return '';
 }
 }
 
 
 function clientLogin($email, $pass) {	//http://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html
 function clientLogin($email, $pass) {	//http://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html
@@ -552,10 +552,10 @@ if (!$system_conf->api_enabled) {
 Minz_Session::init('FreshRSS');
 Minz_Session::init('FreshRSS');
 
 
 $user = authorizationToUser();
 $user = authorizationToUser();
-if (is_null($user)) {
-	unauthorized();
+$conf = null;
+if ($user !== '') {
+	$conf = get_user_configuration($user);
 }
 }
-$conf = get_user_configuration($user);
 
 
 logMe('User => ' . $user . "\n");
 logMe('User => ' . $user . "\n");