From 51c317290be159e3d42395d1f888800fdde7fb0f Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sat, 15 Mar 2025 13:25:59 +0100 Subject: [PATCH] Shorter captcha --- services/context/captcha.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/context/captcha.go b/services/context/captcha.go index da837acb00..58c9205d54 100644 --- a/services/context/captcha.go +++ b/services/context/captcha.go @@ -5,6 +5,7 @@ package context import ( "fmt" + "math/rand" "sync" "code.gitea.io/gitea/modules/base" @@ -55,7 +56,9 @@ func GetImageCaptcha() string { imageCaptchaOnce.Do(func() { captcha.SetCustomStore(&imageCaptchaStore{c: cache.GetCache()}) }) - return captcha.New() + + length := 4 + rand.Intn(2) // 4 or 5 chars + return captcha.NewLen(length) } // SetCaptchaData sets common captcha data