Introduce cleanupSession function
This commit is contained in:
parent
c77cc22955
commit
c84cea1d5c
16
indieauth.go
16
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 = ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user