示例#1
0
文件: login.go 项目: Cepave/grafana
func Logout(c *middleware.Context) {
	c.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl+"/")
	c.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl+"/")
	c.SetCookie("sig", "", -1, setting.AppSubUrl+"/")
	c.Session.Destory(c)
	c.Redirect(setting.ConfigOpenFalcon.Login)
}
示例#2
0
文件: login.go 项目: Cepave/grafana
func LoginView(c *middleware.Context) {
	sig := c.GetCookie("sig")
	if len(sig) > 0 {
		c.Redirect(setting.AppSubUrl + "/")
		return
	} else {
		c.Redirect(setting.ConfigOpenFalcon.Login)
		return
	}

	if err := setIndexViewData(c); err != nil {
		c.Handle(500, "Failed to get settings", err)
		return
	}

	settings := c.Data["Settings"].(map[string]interface{})
	settings["googleAuthEnabled"] = setting.OAuthService.Google
	settings["githubAuthEnabled"] = setting.OAuthService.GitHub
	settings["disableUserSignUp"] = !setting.AllowUserSignUp

	if !tryLoginUsingRememberCookie(c) {
		c.HTML(200, VIEW_INDEX)
		return
	}

	if redirectTo, _ := url.QueryUnescape(c.GetCookie("redirect_to")); len(redirectTo) > 0 {
		c.SetCookie("redirect_to", "", -1, setting.AppSubUrl+"/")
		c.Redirect(redirectTo)
		return
	}

	c.Redirect(setting.AppSubUrl + "/")
}
示例#3
0
文件: chart.go 项目: Cepave/grafana
func OverviewServer(c *middleware.Context) {
	host := c.Params(":host")
	url := "/dashboard/db/status?host=" + host
	c.Redirect(setting.AppSubUrl + url)
}
示例#4
0
文件: chart.go 项目: Cepave/grafana
/**
 * @function name:   func Net(c *middleware.Context)
 * @description:     This function redirects URL "/boss/net/:host" to net chart.
 * @related issues:  OWL-301
 * @param:           c *middleware.Context
 * @return:          void
 * @author:          Don Hsieh
 * @since:           01/27/2015
 * @last modified:   01/27/2015
 * @called by:       r.Get("/boss/net/:host", reqSignedIn, Net)
 *                    in grafana/pkg/api/api.go
 */
func Net(c *middleware.Context) {
	host := c.Params(":host")
	url := getUrl("net", host)
	c.Redirect(setting.AppSubUrl + url)
}