From 3295f40a380553bb3f7f3018cee2e4462e0be417 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Sat, 10 Nov 2012 16:35:16 +0100 Subject: [PATCH] fixed saving in config plugin Saving worked, but did you log out everytime. Now it is checked if the auth mechanism was actually changed before assuming the login is invalid. --- lib/plugins/config/admin.php | 3 +-- lib/plugins/config/settings/extra.class.php | 15 +++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php index 0d314d2e6..4d15bfd85 100644 --- a/lib/plugins/config/admin.php +++ b/lib/plugins/config/admin.php @@ -65,8 +65,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { // save state & force a page reload to get the new settings to take effect $_SESSION['PLUGIN_CONFIG'] = array('state' => 'updated', 'time' => time()); $this->_close_session(); - header("Location: ".wl($ID,array('do'=>'admin','page'=>'config'),true,'&')); - exit(); + send_redirect(wl($ID,array('do'=>'admin','page'=>'config'),true,'&')); } $this->_close_session(); diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index f6adf1c18..6998e1fbf 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -64,7 +64,7 @@ if (!class_exists('setting_authtype')) { // reject disabled plugins if ($plugin_controller->isdisabled($input)) { $this->_error = true; - msg('Auth type ' . $input . ' is disabled.'); + msg('Auth type ' . $input . ' is disabled.', -1); return false; } @@ -74,21 +74,24 @@ if (!class_exists('setting_authtype')) { // @TODO: throw an error in plugin controller instead of returning null if (is_null($auth_plugin)) { $this->_error = true; - msg('Cannot load Auth Plugin "' . $input . '"'); + msg('Cannot load Auth Plugin "' . $input . '"', -1); return false; } // verify proper instanciation (is this really a plugin?) @TODO use instanceof? impement interface? if (is_object($auth_plugin) && !method_exists($auth_plugin, 'getPluginName')) { $this->_error = true; - msg('Cannot create Auth Plugin "' . $input . '"'); + msg('Cannot create Auth Plugin "' . $input . '"', -1); return false; } } - msg('Successfully changed auth system. Please re-login.'); - auth_logoff(); - + // did we change the auth type? logout + global $conf; + if($conf['authtype'] != $input) { + msg('Authentication system changed. Please re-login.'); + auth_logoff(); + } return true; } } -- GitLab