Documentation ¶
Index ¶
- Constants
- Variables
- func GenAndRecordCaptchaID(ctx echo.Context, opt *hdlCaptcha.Options) string
- func GenCaptchaError(ctx echo.Context, err error, captchaName string, data interface{}) echo.Data
- func Get(name string) func() ICaptcha
- func GetAllNames() []string
- func GetCaptchaID(ctx echo.Context, opt *hdlCaptcha.Options, id string) (string, error)
- func GetHistoryOrNewCaptchaID(ctx echo.Context, opt *hdlCaptcha.Options) string
- func GetOk(name string) (func() ICaptcha, bool)
- func Has(name string) bool
- func Register(name string, ic func() ICaptcha)
- func RenderTemplate(ctx echo.Context, captchaType string, templatePath string, options param.Store) template.HTML
- type ICaptcha
Constants ¶
View Source
const ( TypeDefault = `default` TypeAPI = `api` TypeGo = `go` )
Variables ¶
View Source
var ( //ErrCaptcha 验证码错误 ErrCaptcha = echo.NewError(`Captcha is incorrect`, code.CaptchaError) //ErrCaptchaIdMissing 缺少captchaId ErrCaptchaIdMissing = echo.NewError(`Missing captchaId`, code.CaptchaIdMissing).SetZone(`captchaId`) //ErrCaptchaCodeRequired 验证码不能为空 ErrCaptchaCodeRequired = echo.NewError(`Captcha code is required`, code.CaptchaCodeRequired).SetZone(`code`) )
Functions ¶
func GenAndRecordCaptchaID ¶
func GenAndRecordCaptchaID(ctx echo.Context, opt *hdlCaptcha.Options) string
func GenCaptchaError ¶
func GetAllNames ¶
func GetAllNames() []string
func GetCaptchaID ¶
func GetHistoryOrNewCaptchaID ¶
func GetHistoryOrNewCaptchaID(ctx echo.Context, opt *hdlCaptcha.Options) string
Types ¶
type ICaptcha ¶
type ICaptcha interface { Init(echo.H) error // keysValues: key1, value1, key2, value2 Render(ctx echo.Context, templatePath string, keysValues ...interface{}) template.HTML Verify(ctx echo.Context, hostAlias string, name string, captchaIdent ...string) echo.Data MakeData(ctx echo.Context, hostAlias string, name string) echo.H }
Click to show internal directories.
Click to hide internal directories.