Example #1
0
func PopulateWithGlobalData(d *gin.H, c *gin.Context) {
	u, loggedIn := user.Current(c)
	(*d)["LoggedIn"] = loggedIn
	if loggedIn {
		(*d)["CurrentUser"] = u
	}
}
Example #2
0
// GET /login
func SessionNew(c *gin.Context) {
	cu, loggedIn := user.Current(c)
	if loggedIn {
		c.String(http.StatusOK, "Current user: %v", cu.Name)
	} else {
		ctl.Render(c, "users-session-new.tmpl", nil)
	}
}