Przeglądaj źródła

Fix a bug in FreshRSS_Auth::giveAccess()

See https://github.com/FreshRSS/FreshRSS/issues/730
Marien Fressinaud 11 lat temu
rodzic
commit
8e6ab12e89
2 zmienionych plików z 9 dodań i 5 usunięć
  1. 3 3
      app/Models/Auth.php
  2. 6 2
      lib/lib_rss.php

+ 3 - 3
app/Models/Auth.php

@@ -82,11 +82,11 @@ class FreshRSS_Auth {
 	 * Gives access to the current user.
 	 */
 	public static function giveAccess() {
-		$user_conf = Minz_Configuration::get('user');
+		$current_user = Minz_Session::param('currentUser');
+		$user_conf = get_user_configuration($current_user);
 		$system_conf = Minz_Configuration::get('system');
-		$auth_type = $system_conf->auth_type;
 
-		switch ($auth_type) {
+		switch ($system_conf->auth_type) {
 		case 'form':
 			self::$login_ok = Minz_Session::param('passwordHash') === $user_conf->passwordHash;
 			break;

+ 6 - 2
lib/lib_rss.php

@@ -253,10 +253,14 @@ function get_user_configuration($username) {
 		Minz_Configuration::register($namespace,
 		                             join_path(USERS_PATH, $username, 'config.php'),
 		                             join_path(USERS_PATH, '_', 'config.default.php'));
-		return Minz_Configuration::get($namespace);
-	} catch(Minz_ConfigurationException $e) {
+	} catch (Minz_ConfigurationNamespaceException $e) {
+		// namespace already exists, do nothing.
+	} catch (Minz_FileNotExistException $e) {
+		Minz_Log::warning($e->getMessage());
 		return null;
 	}
+
+	return Minz_Configuration::get($namespace);
 }