Check if the user is logged in

This commit is contained in:
Peter Stuifzand 2018-07-14 14:48:57 +02:00
parent 4000e2b441
commit 330d4d70e5

View File

@ -210,6 +210,12 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
sessionVar := c.Value
sess, err := loadSession(sessionVar, conn)
if !sess.LoggedIn {
w.WriteHeader(401)
fmt.Fprintf(w, "Unauthorized")
return
}
var page settingsPage
page.Session = sess
page.Channels = h.Backend.Channels
@ -231,6 +237,12 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
sessionVar := c.Value
sess, err := loadSession(sessionVar, conn)
if !sess.LoggedIn {
w.WriteHeader(401)
fmt.Fprintf(w, "Unauthorized")
return
}
var page settingsPage
page.Session = sess
page.Channels = h.Backend.Channels