login: separate logout page
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 11 Jul 2017 15:57:03 +0000 (17:57 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 12 Jul 2017 02:46:06 +0000 (04:46 +0200)
Move login fallback to a distinct page to allow forced relogin.

login.php
logout.php [new file with mode: 0644]

index 35dc55e34873791721c19ae51f356c7abc45cbc2..67812117f72799d5755a285355cc532ca63bce5e 100644 (file)
--- a/login.php
+++ b/login.php
@@ -1,18 +1,11 @@
 <?php
 require 'auth.inc.php';
 
-if ($editable) {
-       http_response_code(307);
-       header('Location: /');
+if (!$editable) {
+       require 'logout.php';
        exit;
 }
 
-header('WWW-Authenticate: Basic realm=""');
-http_response_code(401);
-
-// fallback page shown on authentication failure
-include 'head.inc.php';
-?>
-<h2>Inloggen mislukt</h2>
-<p>Geen geldige login voor sitebeheer.</p>
+http_response_code(307);
+header('Location: /');
 
diff --git a/logout.php b/logout.php
new file mode 100644 (file)
index 0000000..5b76572
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+header('WWW-Authenticate: Basic realm=""');
+http_response_code(401);
+
+// fallback page shown on authentication failure
+include 'head.inc.php';
+?>
+<h2>Niet ingelogd</h2>
+<p>Voor sitebeheer moet worden ingelogd met een gerechtigde gebruiker.</p>
+