示例#1
0
func update(ctx *web.Context) {
	if ctx.Params["submit"] == "Delete" {
		ctx.SetCookie(web.NewCookie(cookieName, "", -1))
	} else {
		ctx.SetSecureCookie(cookieName, ctx.Params["cookie"], 0)
	}
	ctx.Redirect(301, "/")
}
示例#2
0
文件: mbroker.go 项目: jahrain/gmb
func CheckAuthKeyCookie(ctx *web.Context, subscriber *Subscriber) bool {
	return true
	if len(subscriber._subscriberKey) == 0 {
		key, _ := uuid.NewV4()
		ctx.SetCookie(web.NewCookie("SubscriberKey", key.String(), 0))
		fmt.Println(key)
		subscriber._subscriberKey = key.String()
		return true
	}
	if key, err := ctx.Request.Cookie("SubscriberKey"); err == nil {

		return key.Value == subscriber._subscriberKey
	} else {
		fmt.Println(err)
	}
	return false
}