captcha

package
v2.42.29+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{
	EnableImage:    true,
	EnableAudio:    true,
	EnableDownload: true,
	AudioLangs:     []string{`zh`, `ru`, `en`},
	Prefix:         `/captcha`,
	CookieName:     `captchaId`,
	HeaderName:     `X-Captcha-Id`,
	idGenerator: func(_ echo.Context, _ *Options) (string, error) {
		return captcha.New(), nil
	},
	idExists: func(_ echo.Context, _ *Options, id string) bool {
		return captcha.Exists(id)
	},
}

Functions

func Captcha added in v1.1.1

func Captcha(opts ...*Options) func(echo.Context) error

Types

type ICaptchaID added in v1.6.0

type ICaptchaID interface {
	IDGenerate(echo.Context) (string, error)
	IDExists(echo.Context, string) bool
}

type IDExists added in v1.6.0

type IDExists func(echo.Context, *Options, string) bool

type IDGenerator added in v1.6.0

type IDGenerator func(echo.Context, *Options) (string, error)

type Options

type Options struct {
	EnableImage    bool
	EnableAudio    bool
	EnableDownload bool
	AudioLangs     []string
	Prefix         string
	CookieName     string
	HeaderName     string
	// contains filtered or unexported fields
}

func New added in v1.6.0

func New(prefix string) *Options

func (*Options) IDExists added in v1.6.0

func (o *Options) IDExists(c echo.Context, id string) bool

func (*Options) IDGenerate added in v1.6.0

func (o *Options) IDGenerate(c echo.Context) (string, error)

func (*Options) SetAudioLangs added in v1.6.0

func (o *Options) SetAudioLangs(audioLangs ...string) *Options

func (*Options) SetCookieName added in v1.6.0

func (o *Options) SetCookieName(name string) *Options

func (*Options) SetEnableAudio added in v1.6.0

func (o *Options) SetEnableAudio(enable bool) *Options

func (*Options) SetEnableDownload added in v1.6.0

func (o *Options) SetEnableDownload(enable bool) *Options

func (*Options) SetEnableImage added in v1.6.0

func (o *Options) SetEnableImage(enable bool) *Options

func (*Options) SetHeaderName added in v1.6.0

func (o *Options) SetHeaderName(name string) *Options

func (*Options) SetIDExists added in v1.6.0

func (o *Options) SetIDExists(h IDExists) *Options

func (*Options) SetIDGenerator added in v1.6.0

func (o *Options) SetIDGenerator(h IDGenerator) *Options

func (*Options) SetPrefix added in v1.6.0

func (o *Options) SetPrefix(prefix string) *Options

func (Options) Wrapper

func (o Options) Wrapper(e echo.RouteRegister) echo.IRouter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL