Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCaptcha ¶
GenerateCaptcha 验证码生成
func VerifyCaptcha ¶
Types ¶
type CaptchaReq ¶
type CaptchaReq struct { // 验证码过期时间 ExpireTime time.Duration // 验证码请求时间限制 RequestTimeLimit time.Duration // 验证码请求来源,用于限制请求频次 RequestFor string // phone or email Target string // 验证码长度 Length uint32 // 验证码类型 Type CaptchaType // 验证码生成,为空时使用默认生成 CodeGenFunc func() (string, error) // 发送验证码 SendFunc func() error // contains filtered or unexported fields }
func (*CaptchaReq) RequestCaptcha ¶
func (x *CaptchaReq) RequestCaptcha() (captchaResp *CaptchaResp, err error)
type CaptchaResp ¶
type CaptchaType ¶
type CaptchaType int
const ( CaptchaTypePhone CaptchaType = iota CaptchaTypeEmail )
type CaptchaValidator ¶
func (*CaptchaValidator) CheckCaptcha ¶
func (x *CaptchaValidator) CheckCaptcha() error
Click to show internal directories.
Click to hide internal directories.