summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-11-20 11:14:38 +0100
committerAndrew Dolgov <[email protected]>2005-11-20 11:14:38 +0100
commit8cb7480484d03a06663ac031ad3db33ea46b77ae (patch)
treea5d486db88c66f3d2177917195e633f2b9ebc242
parent2317ffaae70ec345add4eb90c4f79d74ca831e8b (diff)
fix http basic authentication
-rw-r--r--functions.php4
-rw-r--r--logout.php9
-rw-r--r--prefs.php5
-rw-r--r--tt-rss.css6
-rw-r--r--tt-rss.php16
5 files changed, 32 insertions, 8 deletions
diff --git a/functions.php b/functions.php
index 77388106c..b6c426f54 100644
--- a/functions.php
+++ b/functions.php
@@ -604,9 +604,9 @@
}
- function http_authenticate_user($link) {
+ function http_authenticate_user($link, $force_logout) {
- if (!$_SERVER['PHP_AUTH_USER']) {
+ if (!$_SERVER['PHP_AUTH_USER'] || $force_logout) {
header('WWW-Authenticate: Basic realm="Tiny Tiny RSS"');
header('HTTP/1.0 401 Unauthorized');
diff --git a/logout.php b/logout.php
index c43d86cb0..cfc9fd034 100644
--- a/logout.php
+++ b/logout.php
@@ -1,12 +1,17 @@
<?
session_start();
+ require_once "config.php";
+
$_SESSION["uid"] = null;
$_SESSION["name"] = null;
$_SESSION["access_level"] = null;
session_destroy();
- header("Location: login.php");
-
+ if (!USE_HTTP_AUTH) {
+ header("Location: login.php");
+ } else {
+ header("Location: tt-rss.php");
+ }
?>
diff --git a/prefs.php b/prefs.php
index 0673fd36f..ac874a8e4 100644
--- a/prefs.php
+++ b/prefs.php
@@ -12,11 +12,12 @@
if (!USE_HTTP_AUTH) {
if (!$_SESSION["uid"]) {
- header("Location: login.php?rt=prefs.php");
+ header("Location: login.php?rt=tt-rss.php");
exit;
}
} else {
- authenticate_user($link);
+ $force_logout = $_POST["ForceLogout"];
+ http_authenticate_user($link, $force_logout == "yes");
}
} else {
$_SESSION["uid"] = 1;
diff --git a/tt-rss.css b/tt-rss.css
index 0e919c10b..7c3257887 100644
--- a/tt-rss.css
+++ b/tt-rss.css
@@ -587,6 +587,12 @@ td.welcomePrompt {
}
+td.httpWelcomePrompt {
+ font-size : small;
+ color : gray;
+ text-align : right;
+}
+
table.loginForm {
background-image : url("images/vgrad_light_rev.png");
background-color : white;
diff --git a/tt-rss.php b/tt-rss.php
index 0f4a72dc1..9e04bc677 100644
--- a/tt-rss.php
+++ b/tt-rss.php
@@ -16,7 +16,8 @@
exit;
}
} else {
- authenticate_user($link);
+ $force_logout = $_POST["ForceLogout"];
+ http_authenticate_user($link, $force_logout == "yes");
}
} else {
$_SESSION["uid"] = 1;
@@ -77,7 +78,18 @@
</tr><tr><td class="welcomePrompt">
<? if (!SINGLE_USER_MODE) { ?>
- Hello, <b><?= $_SESSION["name"] ?></b> (<a href="logout.php">Logout</a>)</td>
+ <? if (USE_HTTP_AUTH) { ?>
+ <table align="right"><tr>
+ <td class="httpWelcomePrompt">Hello, <b><?= $_SESSION["name"] ?></b></td>
+ <td><form action="tt-rss.php" method="POST">
+ <input type="hidden" name="ForceLogout" value="yes">
+ <input type="submit" class="button" value="Logout">
+ </form>
+ </td></tr></table>
+ <? } else { ?>
+ Hello, <b><?= $_SESSION["name"] ?></b>(<a href="logout.php">Logout</a>)
+ <? } ?>
+ </td>
<? } ?>
</tr></table>
</td>