Finish logging
This commit is contained in:
@@ -228,10 +228,11 @@ func logoutHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
if exist {
|
if exist {
|
||||||
if r.FormValue("csrf_token") != sessionData.CSRFToken {
|
if r.FormValue("csrf_token") != sessionData.CSRFToken {
|
||||||
http.Error(w, "Unable to log user out", http.StatusForbidden)
|
http.Error(w, "Unable to log user out", http.StatusForbidden)
|
||||||
log.Printf("%s attempted to logout with invalid csrf token", sessionData.data.Username)
|
logging.Debugf("%s attempted to logout with invalid csrf token", sessionData.data.Username)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logging.Infof("handling logout event for %s", sessionData.data.Username)
|
||||||
|
|
||||||
deleteSession(token)
|
deleteSession(token)
|
||||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||||
@@ -289,6 +290,8 @@ func logoHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func cleanupSessions() {
|
func cleanupSessions() {
|
||||||
|
logging.Debug("Cleaning up stale session\n")
|
||||||
|
|
||||||
sessionMutex.Lock()
|
sessionMutex.Lock()
|
||||||
defer sessionMutex.Unlock()
|
defer sessionMutex.Unlock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user