diff --git a/application/library/common/captcha.go b/application/library/common/captcha.go index a30952ead..561488411 100644 --- a/application/library/common/captcha.go +++ b/application/library/common/captcha.go @@ -19,7 +19,14 @@ func GetCaptchaEngine(ctx echo.Context, types ...string) (captcha.ICaptcha, erro } create := captcha.Get(typ) if create == nil { - return nil, ctx.NewError(code.Unsupported, `不支持验证码类型: %s`, typ) + if typ != captcha.TypeDefault { + create = captcha.Get(captcha.TypeDefault) + if create == nil { + return nil, ctx.NewError(code.Unsupported, `不支持验证码类型: %s`, typ) + } + } else { + return nil, ctx.NewError(code.Unsupported, `不支持验证码类型: %s`, typ) + } } cpt := create() tcfg := cfg.Children(typ)