captcha

package
v1.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCode

func CreateCode(_ context.Context, captchaType Type, theme Theme, size ...int) (string, string, error)

CreateCode 生成验证码

id 	验证码id
bse64s 	图片base64编码
err 	错误

func GetCodeAnswer

func GetCodeAnswer(codeID string) string

GetCodeAnswer 获取验证码答案

@Pram codeId 验证码id
@Result 验证码答案

func VerifyCaptcha

func VerifyCaptcha(id, VerifyValue string) bool

VerifyCaptcha 验证验证码是否和答案一致

@Pram id 验证码id
@Pram VerifyValue 用户输入的答案
@Result true:正确,false:失败

Types

type Theme

type Theme string

Theme 验证码主题

const (
	// DarkTheme dark
	DarkTheme Theme = "dark"
	// LightTheme light
	LightTheme Theme = "light"
)

type Type

type Type int8

Type 验证码类型

const (
	// TypeAudio 音频验证码
	TypeAudio Type = iota + 1
	// TypeString 字符验证码
	TypeString
	// TypeMath 算术验证码
	TypeMath
	// TypeChinese 汉字验证码
	TypeChinese
	// TypeDigit 数字验证码
	TypeDigit
)

Jump to

Keyboard shortcuts

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