Introduce cleanupSession function

This commit is contained in:
Peter Stuifzand 2018-10-01 22:20:29 +02:00
parent c77cc22955
commit c84cea1d5c

View File

@ -88,12 +88,7 @@ func (h *IndieAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} }
return return
} else if r.URL.Path == "logout" { } else if r.URL.Path == "logout" {
sess.LoggedIn = false cleanupSession(sess)
sess.State = ""
sess.Me = ""
sess.AuthorizationEndpoint = ""
sess.NextURI = ""
sess.RedirectURI = ""
http.Redirect(w, r, "/", 302) http.Redirect(w, r, "/", 302)
return return
} }
@ -137,3 +132,12 @@ func (h *IndieAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} }
} }
} }
func cleanupSession(sess *Session) {
sess.LoggedIn = false
sess.State = ""
sess.Me = ""
sess.AuthorizationEndpoint = ""
sess.NextURI = ""
sess.RedirectURI = ""
}