Compare commits
2 Commits
c84cea1d5c
...
f7b8018c62
| Author | SHA1 | Date | |
|---|---|---|---|
| f7b8018c62 | |||
| 6c06f49279 |
11
indieauth.go
11
indieauth.go
|
|
@ -31,6 +31,10 @@ func (h *IndieAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
defer sess.Flush()
|
||||
|
||||
if r.Method == http.MethodGet {
|
||||
if sess.LoggedIn {
|
||||
http.Redirect(w, r, "/", 302)
|
||||
return
|
||||
}
|
||||
if r.URL.Path == "" {
|
||||
fmt.Fprint(w, `<!doctype html>
|
||||
<html>
|
||||
|
|
@ -78,12 +82,11 @@ func (h *IndieAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
sess.Me = authResponse.Me
|
||||
sess.LoggedIn = true
|
||||
|
||||
log.Printf("SESSION: %#v\n", sess)
|
||||
nextURI := "/"
|
||||
if sess.NextURI != "" {
|
||||
http.Redirect(w, r, sess.NextURI, 302)
|
||||
} else {
|
||||
http.Redirect(w, r, "/", 302)
|
||||
nextURI = sess.NextURI
|
||||
}
|
||||
http.Redirect(w, r, nextURI, 302)
|
||||
return
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user