From e13dc658452526a682779626630779d9cb52a2a4 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 13 Jul 2021 17:03:30 +0800 Subject: [PATCH] aa --- controllers/controller.go | 4 ++-- utils/utils.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/controller.go b/controllers/controller.go index 982a479..1252f8b 100644 --- a/controllers/controller.go +++ b/controllers/controller.go @@ -94,8 +94,8 @@ func callFunc(c *gin.Context, worker func() (retVal interface{}, errCode string, func captchaVerify(c *gin.Context, code string) bool { session := sessions.Default(c) - if captchaId := session.Get(c.ClientIP() + model.SessionKey); captchaId != nil { - session.Delete(c.ClientIP() + model.SessionKey) + if captchaId := session.Get(model.SessionKey); captchaId != nil { + session.Delete(model.SessionKey) _ = session.Save() if captcha.VerifyString(captchaId.(string), code) { return true diff --git a/utils/utils.go b/utils/utils.go index 90cda62..c8cb232 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -65,7 +65,7 @@ func Captcha(c *gin.Context, length ...int) { } captchaId := captcha.NewLen(l) session := sessions.Default(c) - session.Set(c.ClientIP()+model.SessionKey, captchaId) + session.Set(model.SessionKey, captchaId) _ = session.Save() _ = Serve(c.Writer, c.Request, captchaId, ".png", "zh", false, w, h) }