aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-28 01:24:54 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-28 01:24:54 +0100
commit45b2decce03e218fe7ad66479491123ce398ab1f (patch)
tree418b35c5907569318eb209b24f01a03b0f86627d
parent0842be443489690e50636b55aaceac6534645538 (diff)
HTTP Auth user
https://github.com/marienfressinaud/FreshRSS/issues/126
-rw-r--r--app/views/configure/users.phtml4
-rw-r--r--lib/lib_rss.php4
-rw-r--r--p/i/install.php2
3 files changed, 7 insertions, 3 deletions
diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml
index 3640a2ff4..40cce590e 100644
--- a/app/views/configure/users.phtml
+++ b/app/views/configure/users.phtml
@@ -10,7 +10,7 @@
<label class="group-name" for="current_user"><?php echo Minz_Translate::t('current_user'); ?></label>
<div class="group-controls">
<input id="current_user" type="text" disabled="disabled" value="<?php echo Minz_Configuration::currentUser(); ?>" />
- <code>$_SERVER['REMOTE_USER'] = <?php echo isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : ''; ?></code>
+ <code>$_SERVER['REMOTE_USER'] = <?php echo httpAuthUser(); ?></code>
<label class="checkbox" for="is_admin">
<input type="checkbox" id="is_admin" disabled="disabled"<?php echo Minz_Configuration::isAdmin() ? ' checked="checked"' : ''; ?> />
<?php echo Minz_Translate::t('is_admin'); ?>
@@ -61,7 +61,7 @@
<div class="group-controls">
<select id="auth_type" name="auth_type">
<option value="none">None (dangerous)</option>
- <option value="http_auth">HTTP Auth ($_SERVER['REMOTE_USER'])</option>
+ <option value="http_auth">HTTP Auth</option>
<option value="persona">Mozilla Persona</option>
</select>
(selector not implemented yet)
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index c7698b5c5..a27ef171a 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -188,3 +188,7 @@ function usernameFromPath($userPath) {
function listUsers() {
return array_map('usernameFromPath', glob(DATA_PATH . '/*_user.php'));
}
+
+function httpAuthUser() {
+ return isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : '';
+}
diff --git a/p/i/install.php b/p/i/install.php
index 132cd5508..5c654f983 100644
--- a/p/i/install.php
+++ b/p/i/install.php
@@ -806,7 +806,7 @@ function printStep2 () {
<div class="form-group">
<label class="group-name" for="default_user"><?php echo _t ('default_user'); ?></label>
<div class="group-controls">
- <input type="text" id="default_user" name="default_user" maxlength="16" value="<?php echo isset ($_SESSION['default_user']) ? $_SESSION['default_user'] : ''; ?>" placeholder="user1" />
+ <input type="text" id="default_user" name="default_user" maxlength="16" value="<?php echo isset ($_SESSION['default_user']) ? $_SESSION['default_user'] : ''; ?>" placeholder="<?php echo httpAuthUser() == '' ? 'user1' : httpAuthUser(); ?>" />
</div>
</div>