Esempio n. 1
0
func (c Index) DeskAction() {

	c.Data["lc_version"] = config.Config.Version

	//
	session, err := idclient.SessionInstance(c.Session)
	if err != nil || !session.IsLogin() {
		return
	}

	c.Data["nav_user"] = map[string]string{
		"lessids_endpoint":         idclient.ServiceUrl,
		"lessids_endpoint_signout": idclient.ServiceUrl + "/service/sign-out?access_token=" + session.AccessToken,
		"access_token":             session.AccessToken,
		"name":                     session.Name,
		"ukey":                     session.UserID,
		"photo":                    idclient.ServiceUrl + "/v1/service/photo/" + session.UserID,
	}
}
Esempio n. 2
0
func (c Auth) SessionAction() {

	// fmt.Println("session", c.Session.IsLogin())

	set := AuthSession{
		IDsUrl:   idclient.ServiceUrl,
		PhotoUrl: idclient.ServiceUrl + "/v1/service/photo/guest",
	}

	if session, err := idclient.SessionInstance(c.Session); err == nil {

		set.UserID = session.UserID
		set.UserName = session.UserName
		set.Name = session.Name
		set.PhotoUrl = idclient.ServiceUrl + "/v1/service/photo/" + session.UserID
		set.Kind = "AuthSession"

	} else {
		set.Error = &types.ErrorMeta{"401", err.Error()}
	}

	c.RenderJson(set)
}