Make the captcha shorter
Some checks failed
requirements / merge-conditions (pull_request) Has been cancelled
testing / backend-checks (pull_request) Has been cancelled
testing / frontend-checks (pull_request) Has been cancelled
issue-labels / backporting (pull_request_target) Has been cancelled
milestone / set (pull_request_target) Has been cancelled
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Has been cancelled
testing / test-remote-cacher (valkey) (pull_request) Has been cancelled
testing / test-remote-cacher (garnet) (pull_request) Has been cancelled
testing / test-remote-cacher (redict) (pull_request) Has been cancelled
testing / test-mysql (pull_request) Has been cancelled
testing / test-pgsql (pull_request) Has been cancelled
testing / test-sqlite (pull_request) Has been cancelled
testing / security-check (pull_request) Has been cancelled

This commit is contained in:
Minecon724 2025-06-05 09:44:35 +02:00
commit 27c743296b
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