0
0
Fork 0

add first draft for session handling

This commit is contained in:
Gibheer 2015-01-12 21:09:07 +01:00
parent 0563f1f3e0
commit f3be398c18
1 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,10 @@ func NewAdminPages() *AdminPages {
}
func (a *AdminPages) ServeHTTP(w http.ResponseWriter, r *http.Request) {
cookie, _ := r.Cookie("sess")
if cookie == nil && r.URL.Path != "/admin/login" {
http.Redirect(w, r, "/admin/login", http.StatusFound)
}
a.router.ServeHTTP(w, r)
}