From 27c743296becf7ca07711b23c7dfef1ad17ad14d Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Thu, 5 Jun 2025 09:44:35 +0200 Subject: [PATCH] Make the captcha shorter --- 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 8ae8bdcae3..bf8b18f79c 100644 --- a/services/context/captcha.go +++ b/services/context/captcha.go @@ -5,6 +5,7 @@ package context import ( "fmt" + "math/rand" "sync" "forgejo.org/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) + return captcha.NewLen(length) } // SetCaptchaData sets common captcha data