예제 #1
0
파일: login.go 프로젝트: ZhangDewei/myblog
func (this *LogoutController) Get() {
	_, err := lib.GetUserByCookie(this.Ctx)
	if err == true {
		lib.SetCookie(this.Ctx, "", "", -1)
	}
	this.Redirect("/", 301)
}
예제 #2
0
파일: index.go 프로젝트: ZhangDewei/myblog
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
}
예제 #3
0
파일: login.go 프로젝트: ZhangDewei/myblog
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"
}
예제 #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
	}
}