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
|
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 = ""
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user