Example #1
0
func (this *LogoutController) Get() {
	_, err := lib.GetUserByCookie(this.Ctx)
	if err == true {
		lib.SetCookie(this.Ctx, "", "", -1)
	}
	this.Redirect("/", 301)
}
Example #2
0
func ValidMaster(ctx *context.Context) ([]*models.User, bool) {
	user, err := lib.GetUserByCookie(ctx)
	if err == false {
		return user, false
	}
	if user[0].Super == 0 {
		return user, false
	}
	return user, true
}
Example #3
0
func (this *LoginController) Get() {
	_, err := lib.GetUserByCookie(this.Ctx)
	if err == true {
		this.Redirect("/", 301)
		return
	}
	this.TplNames = "login.html"
	this.Layout = "layout.html"
	this.LayoutSections = make(map[string]string)
	this.LayoutSections["HtmlHead"] = "login_head.html"
	this.LayoutSections["Script"] = "login_script.html"
}
Example #4
0
func (this *HomeController) Get() {
	//name := this.GetSession("name")
	//this.Data["session"] = name
	this.TplNames = "index.html"
	this.Layout = "layout.html"
	this.LayoutSections = make(map[string]string)
	this.LayoutSections["HtmlHead"] = "index_head.html"
	this.LayoutSections["Script"] = "index_script.html"
	user, err := lib.GetUserByCookie(this.Ctx)
	if err == true {
		this.Data["uname"] = user[0].Name
	}
}