captcha

package
v0.0.0-...-ead17eb Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const CaptchaSessionKey = "captcha_data"

验证码 Session Key

Variables

View Source
var Store = sessions.NewCookieStore([]byte(config.CfgSession.SessionSecret))

Session 存储配置

Functions

func GenerateCaptchaImage

func GenerateCaptchaImage(question string) (string, error)

Types

type CaptchaProblem

type CaptchaProblem struct {
	Question string      `json:"question"`
	Answer   int         `json:"answer"`
	Type     CaptchaType `json:"type"`
}

验证码问题

func GenerateMathProblem

func GenerateMathProblem() CaptchaProblem

type CaptchaReponse

type CaptchaReponse struct {
	ImageUrl   string `json:"image_url"`
	Question   string `json:"question"`
	ExpireTime int    `json:"expire_time"`
}

type CaptchaType

type CaptchaType int

验证码类型

const (
	Addition       CaptchaType = iota // 加法
	Subtraction                       // 减法
	Multiplication                    // 乘法
	Division                          // 除法
)

Jump to

Keyboard shortcuts

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