add first draft for session handling
This commit is contained in:
parent
0563f1f3e0
commit
f3be398c18
|
@ -20,6 +20,10 @@ func NewAdminPages() *AdminPages {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AdminPages) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
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)
|
a.router.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue