Check if the user is logged in
This commit is contained in:
parent
4000e2b441
commit
330d4d70e5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user