Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisStore ¶
type RedisStore struct {
RedisClient *redis.RedisClient
KeyPrefix string
}
type Store ¶
type Store interface {
// 保存验证码到存储器
Set(id string, value string) bool
// 从存储器中获取验证码的值, 第二个参数代表是否取完就清除存储值
Get(id string, is_clear bool) string
// 验证验证码的正确性
Verify(id string, answer string, is_clear bool) bool
}
定义数字验证码(短信或email发送)相关的存储接口规范 (等着被redis或memcache的等实现)
type VerifyCode ¶
type VerifyCode struct {
StoreType Store
}
func NewVerifyCode ¶
func NewVerifyCode() *VerifyCode
func (*VerifyCode) CheckAnswer ¶
func (vc *VerifyCode) CheckAnswer(key string, answer string) bool
func (*VerifyCode) Generate ¶
func (vc *VerifyCode) Generate(key string) string
Click to show internal directories.
Click to hide internal directories.