Make the captcha shorter

This commit is contained in:
Minecon724 2025-06-05 09:44:35 +02:00
commit fcee34e70d
Signed by: Minecon724
GPG key ID: A02E6E67AB961189

View file

@ -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