Beispiel #1
0
func logOut(w http.ResponseWriter, r *http.Request, re render.Render) {
	log.WriteLog("addr: /logout")
	userInfo := shttp.GetSessionUserInfo(w, r)
	retInfos := getStrMapRetInfo()
	if nil != userInfo {
		userInfo.Logout()
		retInfos["userName"] = userInfo.UserName
	}
	re.HTML(200, "login", retInfos)
}
Beispiel #2
0
func gotoLoginPage(w http.ResponseWriter, r *http.Request, re render.Render) {
	userInfo := shttp.GetSessionUserInfo(w, r)
	retInfos := getStrMapRetInfo()
	if nil == userInfo {
		log.WriteLog("not session user name")
	} else {
		retInfos["userName"] = userInfo.UserName
	}
	re.HTML(200, "login", retInfos)
}
Beispiel #3
0
func (routeRoot *RouteRoot) Routes(m *martini.ClassicMartini) {
	m.Get("/", func(w http.ResponseWriter, r *http.Request, re render.Render) {
		log.WriteLog("addr: /")
		if !shttp.CheckSessionUserLogin(w, r) {
			gotoLoginPage(w, r, re)
		} else {
			gotoRootPage(re, shttp.GetSessionUserInfo(w, r))
		}
	})
}