|
@@ -46,9 +46,8 @@ var (
|
|
|
SendCodeTtl = 20 * 60
|
|
|
)
|
|
|
|
|
|
-func InitCaptcha() {
|
|
|
- for i := range [1]int{} {
|
|
|
- i++
|
|
|
+func InitCaptcha(n int) {
|
|
|
+ for i := 1; i <= n; i++ {
|
|
|
if captcha := slideCaptcha(i); captcha != nil {
|
|
|
captFuncS = append(captFuncS, captcha)
|
|
|
}
|
|
@@ -63,14 +62,14 @@ func InitCaptcha() {
|
|
|
func slideCaptcha(n int) slide.Captcha {
|
|
|
var builder slide.Builder
|
|
|
switch n {
|
|
|
- case 1:
|
|
|
+ case 2:
|
|
|
builder = slide.NewBuilder(
|
|
|
slide.WithGenGraphNumber(2),
|
|
|
+ slide.WithEnableGraphVerticalRandom(true),
|
|
|
)
|
|
|
default:
|
|
|
builder = slide.NewBuilder(
|
|
|
slide.WithGenGraphNumber(2),
|
|
|
- slide.WithEnableGraphVerticalRandom(true),
|
|
|
)
|
|
|
}
|
|
|
// background images
|
|
@@ -104,10 +103,10 @@ func slideCaptcha(n int) slide.Captcha {
|
|
|
slide.WithBackgrounds(imgS),
|
|
|
)
|
|
|
switch n {
|
|
|
- case 1:
|
|
|
- return builder.Make()
|
|
|
- default:
|
|
|
+ case 2:
|
|
|
return builder.MakeWithRegion()
|
|
|
+ default:
|
|
|
+ return builder.Make()
|
|
|
}
|
|
|
}
|
|
|
|