I'm trying to find out the cookie value that is being saved to the clients browser via s.Save(r, w). That way I can store the cookie value in a database before calling renderTemplate(). Is there a way to accomplish this using the gorilla/sessions api?
func login(w http.ResponseWriter, r *http.Request, db *sql.DB, store *sessions.CookieStore, t *template.Template){
if r.Method == "POST" {
r.ParseForm()
username, password, remember := r.FormValue("user[name]"), r.FormValue("user[password]"), r.FormValue("remember_me")
User, err := users.Login(db, username, password, remember, r.RemoteAddr)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
s, _ := store.Get(r, "rp-session") //returns a new session
s.Save(r, w)
//fmt.Println(s.Values)
renderTemplate(w, "user_nav_info", t, User)
}
}