Skip to content

Commit b6a087d

Browse files
authored
Merge pull request #41 from kulti/patch-1
UserID should be set after authorize confirmation
2 parents de114d6 + 6bce93a commit b6a087d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

example/server/server.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func loginHandler(w http.ResponseWriter, r *http.Request) {
8686
http.Error(w, err.Error(), http.StatusInternalServerError)
8787
return
8888
}
89-
us.Set("UserID", "000000")
89+
us.Set("LoggedInUserID", "000000")
9090
w.Header().Set("Location", "/auth")
9191
w.WriteHeader(http.StatusFound)
9292
return
@@ -100,7 +100,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
100100
http.Error(w, err.Error(), http.StatusInternalServerError)
101101
return
102102
}
103-
if us.Get("UserID") == nil {
103+
if us.Get("LoggedInUserID") == nil {
104104
w.Header().Set("Location", "/login")
105105
w.WriteHeader(http.StatusFound)
106106
return
@@ -113,6 +113,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
113113
w.Header().Set("Location", u.String())
114114
w.WriteHeader(http.StatusFound)
115115
us.Delete("Form")
116+
us.Set("UserID", us.Get("LoggedInUserID"))
116117
return
117118
}
118119
outputHTML(w, r, "static/auth.html")

0 commit comments

Comments
 (0)