Skip to content

Commit 073fe81

Browse files
authored
Merge pull request #130 from satheshshiva/feature/fix_server_example
get the actual username instead of the hard coded "000000"
2 parents 6f942a4 + 6c6ca40 commit 073fe81

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

example/server/server.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,13 @@ func loginHandler(w http.ResponseWriter, r *http.Request) {
143143
}
144144

145145
if r.Method == "POST" {
146-
store.Set("LoggedInUserID", "000000")
146+
if r.Form == nil {
147+
if err := r.ParseForm(); err != nil {
148+
http.Error(w, err.Error(), http.StatusInternalServerError)
149+
return
150+
}
151+
}
152+
store.Set("LoggedInUserID", r.Form.Get("username"))
147153
store.Save()
148154

149155
w.Header().Set("Location", "/auth")

0 commit comments

Comments
 (0)