login: return success status to whatsapp crawler
[minimedit.git] / login / index.php
index 38b7c234465006445ac2d89491b9c3cc7c60cc7b..cfe00278f0e1f6dfbb66ecef60a859859725b403 100644 (file)
@@ -39,7 +39,10 @@ elseif (isset($_GET['logout'])) {
 if (!$User or !$User->login) {
        $Page->title = 'Inloggen';
        if (isset($_REQUEST['goto'])) {
-               if (empty($message)) http_response_code(403);
+               if (empty($message)
+               and !preg_match('(^WhatsApp/)', $_SERVER['HTTP_USER_AGENT'])) {
+                       http_response_code(403);
+               }
                $target = ltrim($_REQUEST['goto'], '/');
                $target = new ArchiveArticle("$target.html");
                $target->index; # run forbidden handler to determine metadata
@@ -59,7 +62,7 @@ if (!$User or !$User->login) {
 
 if (isset($_REQUEST['goto'])) {
        $target = ltrim($_REQUEST['goto'], '/');
-       abort("/$target", 302);
+       abort("/$target", '303 Return');
 }
 
 if (isset($Page->raw)) {