//GetLocale from request func GetLocale(request prago.Request) string { user, hasUser := request.GetData("currentuser").(*User) if hasUser { if validLocale(user.Locale) { return user.Locale } } return localeFromRequest(request) }
//GetUser returns currently logged in user func GetUser(request prago.Request) *User { return request.GetData("currentuser").(*User) }
//CSRFToken returns csrf token from request func CSRFToken(request prago.Request) string { return request.GetData("_csrfToken").(string) }
//AddFlashMessage adds flash message to request func AddFlashMessage(request prago.Request, message string) { session := request.GetData("session").(*sessions.Session) session.AddFlash(message) prago.Must(session.Save(request.Request(), request.Response())) }