added logout
This commit is contained in:
parent
a8ff26af15
commit
da59b397fc
10
handlers.go
10
handlers.go
@ -26,9 +26,9 @@ func loginHandler(w http.ResponseWriter, req *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func logoutHandler(w http.ResponseWriter, req *http.Request) {
|
func logoutHandler(w http.ResponseWriter, req *http.Request) {
|
||||||
session, _ := store.Get(req, "creds")
|
session, _ := store.Get(req, "creds")
|
||||||
delete(session.Values, "logged in")
|
delete(session.Values, "logged in")
|
||||||
session.Save(req, w)
|
session.Save(req, w)
|
||||||
http.Redirect(w, req, "/", http.StatusSeeOther)
|
http.Redirect(w, req, "/", http.StatusSeeOther)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user