captcha

package
v0.0.0-...-57fd995 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCaptcha

func NewCaptcha(conf Config, store base64Captcha.Store) (*base64Captcha.Captcha, error)

Types

type Config

type Config struct {
	Type       string
	Height     int
	Width      int
	NoiseCount int
	Length     int
	ExpireTime int
}

type RedisStore

type RedisStore struct {
	// contains filtered or unexported fields
}

func NewRedisStore

func NewRedisStore(redis *redis.Client, expireTime time.Duration, prefix string) *RedisStore

func (RedisStore) Get

func (r RedisStore) Get(id string, clear bool) string

Get 通过id从redis中获取验证码 clear 为 true 时会删除验证码

func (RedisStore) GetId

func (r RedisStore) GetId(id string) string

func (RedisStore) Set

func (r RedisStore) Set(id string, value string) error

Set 将验证码存储到redis中, 并设置验证码过期时间为半个小时

func (RedisStore) Verify

func (r RedisStore) Verify(id, answer string, clear bool) bool

Jump to

Keyboard shortcuts

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