func (wi *WebInstance) ParseCookieReason(w http.ResponseWriter, r *http.Request, data *map[string]interface{}) bool { v := utils.GetCookieValue(r, "reason") if len(v) == 0 { return false } (*data)["hasReason"] = true (*data)["reason"] = v utils.EraseCookie(w, r, "reason") return true }
func GetUserFromCookie(r *http.Request, db *mgo.Database) *User { sid := utils.GetCookieValue(r, "SID") if len(sid) == 0 { return nil } var user *User db.C("users").Find(bson.M{"lastSID": string(sid)}).One(&user) if user == nil { return nil } return user }