Added page protection and reauthentication tests

This commit is contained in:
2025-02-16 15:15:52 +11:00
parent deaeddb533
commit 31f1b83da4
4 changed files with 172 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ func RequiresLogin(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user := contexts.GetUser(r.Context())
if user == nil {
w.WriteHeader(http.StatusUnauthorized)
page.Error(
"401",
"Unauthorized",