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