From 880a86f666dce1d2f035a0bf2e8c20ace1688dff Mon Sep 17 00:00:00 2001 From: Marcel van Dorp Date: Fri, 29 Apr 2011 12:46:49 +1000 Subject: [PATCH] SF Feature #3122736 - HTTP authentication realm --- config/config.php.example | 3 +++ htdocs/login_form.php | 2 +- lib/config_default.php | 20 ++++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/config/config.php.example b/config/config.php.example index 17ee925..8b49506 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -49,6 +49,9 @@ to a big random string. */ // $config->custom->session['blowfish'] = null; +/* If your auth_type is http, you can override your HTTP Authentication Realm. */ +// $config->custom->session['http_realm'] = sprintf('%s %s',app_name(),'login'); + /* The language setting. If you set this to 'auto', phpLDAPadmin will attempt to determine your language automatically. Otherwise, available lanaguages are: 'ct', 'de', 'en', 'es', 'fr', 'it', 'nl', and 'ru' diff --git a/htdocs/login_form.php b/htdocs/login_form.php index f1ac539..f16bdbf 100644 --- a/htdocs/login_form.php +++ b/htdocs/login_form.php @@ -41,7 +41,7 @@ if ($app['server']->getAuthType() == 'http') { die(); } - header(sprintf('WWW-Authenticate: Basic realm="%s %s"',app_name(),_('login'))); + header(sprintf('WWW-Authenticate: Basic realm="%s"',$_SESSION[APPCONFIG]->getValue('session','http_realm'))); if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.0') header('HTTP/1.0 401 Unauthorized'); // http 1.0 method diff --git a/lib/config_default.php b/lib/config_default.php index e9d7117..2eb494a 100644 --- a/lib/config_default.php +++ b/lib/config_default.php @@ -477,14 +477,6 @@ class Config { 'desc'=>'Blowfish key to encrypt cookie details', 'default'=>null); - $this->default->session['memorylimit'] = array( - 'desc'=>'Set the PHP memorylimit warning threshold.', - 'default'=>24); - - $this->default->session['timelimit'] = array( - 'desc'=>'Set the PHP timelimit.', - 'default'=>30); - /** Cookie Time * If you used auth_type 'form' in the servers list, you can adjust how long the cookie will last * (default is 0 seconds, which expires when you close the browser) @@ -493,6 +485,18 @@ class Config { 'desc'=>'Time in seconds for the life of cookies', 'default'=>0); + $this->default->session['http_realm'] = array( + 'desc'=>'HTTP Authentication Realm', + 'default'=>sprintf('%s %s',app_name(),_('login'))); + + $this->default->session['memorylimit'] = array( + 'desc'=>'Set the PHP memorylimit warning threshold.', + 'default'=>24); + + $this->default->session['timelimit'] = array( + 'desc'=>'Set the PHP timelimit.', + 'default'=>30); + /** * Session Menu */