validator

package
v0.0.0-...-5c0bb04 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LifeTime       = 3600 * 3      // 邮件有效期 3 小时
	MaxTimes       = 20            // 每个邮件验证码最多验证次数
	CacheKeyPrefix = "email_code_" // email validator cache key prefix
)

Variables

View Source
var ErrEmailVerifyExpired = errors.New("email verify expired")

ErrEmailVerifyExpired check code error `email verify expired`

Functions

func CacheKey

func CacheKey(key string) string

CacheKey get captcha cache key

func CheckCode

func CheckCode(email, code string) (bool, error)

CheckCode check cache code and code

func CodeInfo

func CodeInfo(email string) (string, int)

CodeInfo return validator code and times

func Content

func Content(to, appName, code string) string

Content get validator content

func GenerateCode

func GenerateCode(email string) string

GenerateCode generate validator code

func Send

func Send(to string, appName, code string) error

Send validator email content

Types

This section is empty.

Jump to

Keyboard shortcuts

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