package middleware import ( "net/http" "wyo.town/netzah/session" ) func RequireAuth(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if !session.Manager.Exists(r.Context(), "user") { http.Redirect(w, r, "/login", http.StatusFound) return } next.ServeHTTP(w, r) }) }