diff options
| author | 2015-01-06 21:40:19 +0100 | |
|---|---|---|
| committer | 2015-01-06 21:40:19 +0100 | |
| commit | dd41642ce617ccf873974d884043c21c1fe10223 (patch) | |
| tree | c1aa6da8c3508ed608aa6088a74a3b0441aff1fb /app/Controllers/authController.php | |
| parent | 17a280230f1e47d092d8e22bc5d1041e7a84979f (diff) | |
Fix calls to FreshRSS_Configuration
Replaced by a get_user_configuration() function in lib_rss.
This function register a new configuration based on the given username
and return the corresponding configuration.
See https://github.com/FreshRSS/FreshRSS/issues/730
Diffstat (limited to 'app/Controllers/authController.php')
| -rw-r--r-- | app/Controllers/authController.php | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 02b8119e9..e1f895412 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -121,12 +121,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController { $username = Minz_Request::param('username', ''); $challenge = Minz_Request::param('challenge', ''); - // TODO #730: change the way to get the configuration - try { - $conf = new FreshRSS_Configuration($username); - } catch(Minz_Exception $e) { - // $username is not a valid user, nor the configuration file! - Minz_Log::warning('Login failure: ' . $e->getMessage()); + $conf = get_user_configuration($username); + if (is_null($conf)) { Minz_Request::bad(_t('feedback.auth.login.invalid'), array('c' => 'auth', 'a' => 'login')); } @@ -167,12 +163,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController { return; } - // TODO #730: change the way to get the configuration - try { - $conf = new FreshRSS_Configuration($username); - } catch(Minz_Exception $e) { - // $username is not a valid user, nor the configuration file! - Minz_Log::warning('Login failure: ' . $e->getMessage()); + $conf = get_user_configuration($username); + if (is_null($conf)) { return; } @@ -240,14 +232,12 @@ class FreshRSS_auth_Controller extends Minz_ActionController { $persona_file = DATA_PATH . '/persona/' . $email . '.txt'; if (($current_user = @file_get_contents($persona_file)) !== false) { $current_user = trim($current_user); - // TODO #730: change the way to get the configuration - try { - $conf = new FreshRSS_Configuration($current_user); + $conf = get_user_configuration($current_user); + if (!is_null($conf)) { $login_ok = strcasecmp($email, $conf->mail_login) === 0; - } catch (Minz_Exception $e) { - //Permission denied or conf file does not exist + } else { $reason = 'Invalid configuration for user ' . - '[' . $current_user . '] ' . $e->getMessage(); + '[' . $current_user . ']'; } } } else { @@ -309,8 +299,11 @@ class FreshRSS_auth_Controller extends Minz_ActionController { return; } - // TODO #730 - $conf = new FreshRSS_Configuration(FreshRSS_Context::$system_conf->default_user); + $conf = get_user_configuration(FreshRSS_Context::$system_conf->default_user); + if (is_null($conf)) { + return; + } + // Admin user must have set its master password. if (!$conf->passwordHash) { $this->view->message = array( |
