Compare commits
No commits in common. "67e617c969477c4faaa947089efcecef3b798ded" and "f039df69a5e210cef35f9efd9f5d673172140fcc" have entirely different histories.
67e617c969
...
f039df69a5
|
|
@ -516,29 +516,28 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
sess, err := loadSession(sessionVar, conn)
|
sess, err := loadSession(sessionVar, conn)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
http.Redirect(w, r, "/", 302)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
sess.AuthorizationEndpoint = endpoints.AuthorizationEndpoint
|
sess.AuthorizationEndpoint = endpoints.AuthorizationEndpoint
|
||||||
sess.Me = meURL.String()
|
sess.Me = meURL.String()
|
||||||
sess.State = state
|
sess.State = state
|
||||||
sess.RedirectURI = redirectURI
|
sess.RedirectURI = redirectURI
|
||||||
sess.LoggedIn = false
|
sess.LoggedIn = false
|
||||||
|
saveSession(sessionVar, &sess, conn)
|
||||||
|
|
||||||
err = saveSession(sessionVar, &sess, conn)
|
authenticationURL := indieauth.CreateAuthenticationURL(*authURL, meURL.String(), ClientID, redirectURI, state)
|
||||||
if err != nil {
|
|
||||||
|
http.Redirect(w, r, authenticationURL, 302)
|
||||||
|
return
|
||||||
|
} else if r.URL.Path == "/session/logout" {
|
||||||
|
c, err := r.Cookie("session")
|
||||||
|
|
||||||
|
if err == http.ErrNoCookie {
|
||||||
http.Redirect(w, r, "/", 302)
|
http.Redirect(w, r, "/", 302)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticationURL := indieauth.CreateAuthenticationURL(*authURL, meURL.String(), ClientID, redirectURI, state)
|
sessionVar := c.Value
|
||||||
http.Redirect(w, r, authenticationURL, 302)
|
conn.Do("DEL", "session:"+sessionVar)
|
||||||
|
http.Redirect(w, r, "/", 302)
|
||||||
return
|
|
||||||
} else if r.URL.Path == "/session/logout" {
|
|
||||||
httpSessionLogout(r, w, conn)
|
|
||||||
return
|
return
|
||||||
} else if r.URL.Path == "/auth/approve" {
|
} else if r.URL.Path == "/auth/approve" {
|
||||||
// create a code
|
// create a code
|
||||||
|
|
@ -669,16 +668,3 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func httpSessionLogout(r *http.Request, w http.ResponseWriter, conn redis.Conn) {
|
|
||||||
c, err := r.Cookie("session")
|
|
||||||
if err == http.ErrNoCookie {
|
|
||||||
http.Redirect(w, r, "/", 302)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err == nil {
|
|
||||||
sessionVar := c.Value
|
|
||||||
_, _ = conn.Do("DEL", "session:"+sessionVar)
|
|
||||||
}
|
|
||||||
http.Redirect(w, r, "/", 302)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,6 @@ func NewApp(options AppOptions) (*App, error) {
|
||||||
|
|
||||||
http.Handle("/micropub", µpubHandler{
|
http.Handle("/micropub", µpubHandler{
|
||||||
Backend: app.backend,
|
Backend: app.backend,
|
||||||
pool: options.pool,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
handler, broker := server.NewMicrosubHandler(app.backend)
|
handler, broker := server.NewMicrosubHandler(app.backend)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user