login: indicate failure in http status codes
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 10 Feb 2019 06:33:25 +0000 (07:33 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 10 Feb 2019 08:22:03 +0000 (09:22 +0100)
Track results in access logs.

login/index.php
login/pass/index.php

index a966cfa78cc89788ff51e41e4f38b3de3ff6fdca..86af0744a4587ea1d9aeab162384a34cb5371641 100644 (file)
@@ -10,10 +10,12 @@ if (isset($_POST['mail'])) {
                        $message = "Er is een e-mail verstuurd naar $inputq.";
                }
                else {
+                       http_response_code(404);
                        $message = "E-mailadres $inputq is nergens ingesteld.";
                }
        }
        catch (Exception $e) {
+               http_response_code(500);
                $message = "E-mail kon niet verstuurd worden."
                        . " Probeer het later nog eens of neem contact op.";
        }
@@ -23,6 +25,7 @@ elseif (isset($_POST['login'])) {
                login_setcookie();
        }
        else {
+               http_response_code(403);
                $message = 'Ongeldige gebruikersnaam of wachtwoord.';
        }
 }
index 4fc6543d57fff397a88f720dcba50bcd0d077782..09984acce513349090f6287cc1c0e7e19e04c32a 100644 (file)
@@ -11,6 +11,7 @@ if (isset($_GET['token'])) {
                ];
        }
        else {
+               http_response_code(403);
                print "<p class=warn>Code onjuist, geen toestemming om wachtwoord in te stellen.</p>\n";
                return TRUE;
        }
@@ -29,6 +30,7 @@ if ($_POST) {
                print "<p>Het wachtwoord is aangepast voor <em>{$User['name']}</em>. Voortaan met het nieuwe wachtwoord inloggen.</p>\n\n";
                return;
        }
+       http_response_code(400);
        print "<p class=warn>$error</p>\n\n";
 }