A free, self-hostable news aggregator…
Implémente sélecteur de méthode d’authentification
Alexandre Alapetite220341b40642
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.phpindex aabc3e4af..0c0b4951d 100755--- a/app/Controllers/configureController.php+++ b/app/Controllers/configureController.php@@ -326,10 +326,13 @@ class FreshRSS_configure_Controller extends Minz_ActionController {Minz_Session::_param('mail', $this->view->conf->mail_login);if (Minz_Configuration::isAdmin()) {- $anon = (Minz_Request::param('anon_access', false));+ $anon = Minz_Request::param('anon_access', false);$anon = ((bool)$anon) && ($anon !== 'no');- if ($anon != Minz_Configuration::allowAnonymous()) {+ $auth_type = Minz_Request::param('auth_type', 'none');+ if ($anon != Minz_Configuration::allowAnonymous() ||+ $auth_type != Minz_Configuration::authType()) {Minz_Configuration::_allowAnonymous($anon);+ Minz_Configuration::_authType($auth_type);$ok &= Minz_Configuration::writeFile();}}diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtmlindex 4fd291ba3..7e8edf9af 100644--- a/app/views/configure/users.phtml+++ b/app/views/configure/users.phtml@@ -60,11 +60,10 @@<label class="group-name" for="auth_type"><?php echo Minz_Translate::t('auth_type'); ?></label><div class="group-controls"><select id="auth_type" name="auth_type">- <option value="none">None (dangerous)</option>- <option value="http_auth">HTTP Auth</option>- <option value="persona">Mozilla Persona</option>+ <option value="none"<?php echo Minz_Configuration::authType() === 'none' ? ' selected="selected"' : ''; ?>>None (dangerous)</option>+ <option value="http_auth"<?php echo Minz_Configuration::authType() === 'http_auth' ? ' selected="selected"' : ''; ?>>HTTP Auth</option>+ <option value="persona"<?php echo Minz_Configuration::authType() === 'persona' ? ' selected="selected"' : ''; ?>>Mozilla Persona</option></select>- (selector not implemented yet)</div></div>diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.phpindex 3864a9335..d0c530ef7 100644--- a/lib/Minz/Configuration.php+++ b/lib/Minz/Configuration.php@@ -53,6 +53,7 @@ class Minz_Configuration {private static $default_user = '';private static $current_user = '';private static $allow_anonymous = false;+ private static $auth_type = 'none';private static $db = array ('host' => false,@@ -103,9 +104,23 @@ class Minz_Configuration {public static function allowAnonymous() {return self::$allow_anonymous;}+ public static function authType() {+ return self::$auth_type;+ }+public static function _allowAnonymous($allow = false) {self::$allow_anonymous = (bool)$allow;}+ public static function _authType($value) {+ $value = strtolower($value);+ switch ($value) {+ case 'none':+ case 'http_auth':+ case 'persona':+ self::$auth_type = $value;+ break;+ }+ }/*** Initialise les variables de configuration@@ -133,6 +148,7 @@ class Minz_Configuration {'title' => self::$title,'default_user' => self::$default_user,'allow_anonymous' => self::$allow_anonymous,+ 'auth_type' => self::$auth_type,),'db' => self::$db,);@@ -234,6 +250,9 @@ class Minz_Configuration {if (isset ($general['allow_anonymous'])) {self::$allow_anonymous = ((bool)($general['allow_anonymous'])) && ($general['allow_anonymous'] !== 'no');}+ if (isset ($general['auth_type'])) {+ self::_authType($general['auth_type']);+ }// Base de données$db = false;