From eed038bf015c95832962728fc7ea2d930f7f6d89 Mon Sep 17 00:00:00 2001 From: coward Date: Mon, 13 May 2024 09:15:27 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/captcha_store.go | 7 +++---- http/api/captcha.go | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/component/captcha_store.go b/component/captcha_store.go index abf91ce..37387c7 100644 --- a/component/captcha_store.go +++ b/component/captcha_store.go @@ -3,7 +3,6 @@ package component import ( "context" "fmt" - "os" "strings" "time" "wireguard-dashboard/client" @@ -50,8 +49,8 @@ func (CaptchaStore) Get(id string, clear bool) string { // @param clear // @return bool func (c CaptchaStore) Verify(id, answer string, clear bool) bool { - if os.Getenv("GIN_MODE") != "release" { - return true - } + //if os.Getenv("GIN_MODE") != "release" { + // return true + //} return strings.ToUpper(answer) == strings.ToUpper(c.Get(id, clear)) } diff --git a/http/api/captcha.go b/http/api/captcha.go index bc19f82..22b731d 100644 --- a/http/api/captcha.go +++ b/http/api/captcha.go @@ -18,7 +18,7 @@ func Captcha() captcha { // @receiver captcha // @param c func (captcha) GenerateCaptcha(c *gin.Context) { - math := base64Captcha.DriverMath{Height: 60, Width: 240, Fonts: []string{"ApothecaryFont.ttf", "3Dumb.ttf"}} + math := base64Captcha.DriverMath{Height: 120, Width: 480, Fonts: []string{"ApothecaryFont.ttf", "3Dumb.ttf"}} mathDriver := math.ConvertFonts() capt := base64Captcha.NewCaptcha(mathDriver, component.CaptchaStore{})