Make the captcha shorter #6

Merged
Minecon724 merged 1 commit from captcha-length into forgejo 2025-06-05 09:48:03 +02:00

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