diff --git a/indieauth.go b/indieauth.go index b5610c8..3871c09 100644 --- a/indieauth.go +++ b/indieauth.go @@ -88,12 +88,7 @@ func (h *IndieAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } return } else if r.URL.Path == "logout" { - sess.LoggedIn = false - sess.State = "" - sess.Me = "" - sess.AuthorizationEndpoint = "" - sess.NextURI = "" - sess.RedirectURI = "" + cleanupSession(sess) http.Redirect(w, r, "/", 302) 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 = "" +}