captcha

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 6 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Captcha

type Captcha struct {
	Base64Captcha *base64Captcha.Captcha
}

func NewCaptcha

func NewCaptcha() *Captcha

NewCaptcha 单例模式获取

func (*Captcha) GenerateCaptcha

func (c *Captcha) GenerateCaptcha() (id string, b64s string, err error)

GenerateCaptcha 生成图片验证码

func (*Captcha) VerifyCaptcha

func (c *Captcha) VerifyCaptcha(id string, answer string) (match bool)

VerifyCaptcha 验证验证码是否正确

type RedisStore

type RedisStore struct {
	RedisClient *redis.RedisClient
	KeyPrefix   string
}

RedisStore 实现 base64Captcha.Store interface

func (*RedisStore) Get

func (s *RedisStore) Get(key string, clear bool) string

Get 实现 base64Captcha.Store interface 的 Get 方法

func (*RedisStore) Set

func (s *RedisStore) Set(key string, value string) error

Set 实现 base64Captcha.Store interface 的 Set 方法

func (*RedisStore) Verify

func (s *RedisStore) Verify(key, answer string, clear bool) bool

Verify 实现 base64Captcha.Store interface 的 Verify 方法

Jump to

Keyboard shortcuts

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