Always redirect to homepage when not logged in

This commit is contained in:
Peter Stuifzand 2020-07-04 15:03:37 +02:00
parent 89e31ed338
commit 32c8f0cfa0

10
main.go
View File

@ -473,6 +473,11 @@ func (h *graphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}()
if !sess.LoggedIn {
http.Redirect(w, r, "/", http.StatusFound)
return
}
refs := make(Refs)
f, err := os.Open(filepath.Join(mp.(*FilePages).dirname, "backrefs.json"))
@ -613,6 +618,11 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}()
if !sess.LoggedIn {
http.Redirect(w, r, "/", http.StatusFound)
return
}
format := r.URL.Query().Get("format")
if format == "" {
format = "html"