Documentation
¶
Overview ¶
Package captcha a middleware that provides captcha service for Macaron.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Captcha ¶
type Captcha struct {
// contains filtered or unexported fields
}
func (*Captcha) CreateCaptcha ¶
func (*Captcha) CreateHtml ¶
type Captchas ¶
type Captchas struct {
Options
}
Captcha represents a captcha service.
func (*Captchas) CreateCaptcha ¶
create a new captcha id
func (*Captchas) CreateHtml ¶
tempalte func for output html
func (*Captchas) GenRandChars ¶
func (*Captchas) Handle ¶
Captchaer is a middleware that maps a captcha.Captcha service into the Macaron handler chain. An single variadic captcha.Options struct can be optionally provided to configure. This should be register after cache.Cacher.
type Image ¶
type Options ¶
type Options struct {
Caches *cache.Caches
// Suburl path. Default is empty.
SubURL string
// URL prefix of getting captcha pictures. Default is "/captcha/".
URLPrefix string
// Hidden input element ID. Default is "captcha_id".
FieldIdName string
// User input value element name in request form. Default is "captcha".
FieldCaptchaName string
// Challenge number. Default is 6.
ChallengeNums int
// Captcha image width. Default is 240.
Width int
// Captcha image height. Default is 80.
Height int
// Captcha expiration time in seconds. Default is 600.
Expiration int64
// Cache key prefix captcha characters. Default is "captcha_".
CachePrefix string
}
Click to show internal directories.
Click to hide internal directories.