func SearchAnswersNew(r render.Render, db *mgo.Database, req *http.Request, session sessions.Session) {
	lastGameIdSearched := session.Get("last_game_id_searched")

	templateData := map[string]interface{}{"metatitle": "Battle Answers", "currentPath": req.URL.Path,
		"lastGameIdSearched": lastGameIdSearched, "games": models.GetGameRecs(db, nil)}
	r.HTML(200, "search_answers/new", templateData)
}
Ejemplo n.º 2
0
// UpdateUser updates the User object stored in the session. This is useful incase a change
// is made to the user model that needs to persist across requests.
func UpdateUser(s sessions.Session, user User) error {
	s.Set("AUTHUNIQUEID", user.UniqueId())
	return nil
}
Ejemplo n.º 3
0
// Logout will clear out the session and call the Logout() user function.
func Logout(s sessions.Session, user User) {
	user.Logout()
	s.Delete("AUTHUNIQUEID")
}
Ejemplo n.º 4
0
func Auth(res http.ResponseWriter, req *http.Request, session sessions.Session) {
	if session.Get("login") != true {
		http.Error(res, "forbidden", http.StatusForbidden)
	}
}
func SearchAnswersCreate(form SearchAnswerForm, r render.Render, db *mgo.Database, req *http.Request, session sessions.Session) {
	session.Set("last_game_id_searched", form.GameId)

	SearchAnswersIndex(r, db, form.GameId, form.Keywords, req)
}