summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Thomson <blumatrikz@gmail.com>2026-09-20 21:59:08 -0700
committerConnor Thomson <blumatrikz@gmail.com>2026-09-20 21:59:08 -0700
commit371800f1cb0987b3d77d9babceb4ffd99e8cd060 (patch)
treeb776cb29528fc4d57bc41425df6b40afdc22222f
parent070a27baa8f93c3bf191459b88d24d7430a78899 (diff)
Remove forbidden.html and make it so require_admin() gives more info if it failsHEADstagingmaster
-rwxr-xr-xhtml/forbidden.html21
-rw-r--r--php/user.php7
2 files changed, 5 insertions, 23 deletions
diff --git a/html/forbidden.html b/html/forbidden.html
deleted file mode 100755
index 791fa4e..0000000
--- a/html/forbidden.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
- GNUfault.org - GNUfault's website
- Copyright (C) 2026 Connor Thomson
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
--->
-
-<h2>403 Forbidden</h2>
-<hr>
-<p>You do not have permission to view this page.</p>
diff --git a/php/user.php b/php/user.php
index 9521dc5..7eafd20 100644
--- a/php/user.php
+++ b/php/user.php
@@ -52,9 +52,12 @@ function require_admin(): void {
return;
}
- http_response_code(403);
+ if (get_user_id() === null) {
+ http_response_code(401);
+ } else {
+ http_response_code(403);
+ }
- render_content(ROOT . '/html/forbidden.html');
exit;
}