captcha

package
v2.37.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 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
	},
}

Functions

func Captcha added in v1.1.1

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

Types

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
	IDGenerator    IDGenerator
}

func New added in v1.6.0

func New(prefix string) *Options

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) 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