Merge pull request 'Make the captcha shorter' (#6) from captcha-length into forgejo
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Reviewed-on: #6
This commit is contained in:
commit
ebe3f887ae
1 changed files with 4 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ package context
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"forgejo.org/modules/base"
|
"forgejo.org/modules/base"
|
||||||
|
|
@ -55,7 +56,9 @@ func GetImageCaptcha() string {
|
||||||
imageCaptchaOnce.Do(func() {
|
imageCaptchaOnce.Do(func() {
|
||||||
captcha.SetCustomStore(&imageCaptchaStore{c: cache.GetCache()})
|
captcha.SetCustomStore(&imageCaptchaStore{c: cache.GetCache()})
|
||||||
})
|
})
|
||||||
return captcha.New()
|
|
||||||
|
length := 4 + rand.Intn(2)
|
||||||
|
return captcha.NewLen(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCaptchaData sets common captcha data
|
// SetCaptchaData sets common captcha data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue