captchaDb is now of type CaptchaDB interface. Use a constructor for InMemoryCaptchaDB.
A new captcha is now being created here instead of passed as an argument.
This commit is contained in:
parent
517ebb1689
commit
916b85500d
@ -6,15 +6,15 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var captchaDb captcha.InMemoryCaptchaDB = captcha.InMemoryCaptchaDB{
|
var captchaDb captcha.CaptchaDB
|
||||||
DB: make(map[captcha.ID]captcha.Captcha)}
|
|
||||||
|
|
||||||
func Init(expiry time.Duration) {
|
func Init(expiry time.Duration) {
|
||||||
captchaDb.SetExpiry(expiry)
|
captchaDb = captcha.NewInMemoryCaptchaDB(expiry)
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(data string, captcha captcha.Captcha) (captcha.Captcha, captcha.ID) {
|
func New(data string) (captcha.Captcha, captcha.ID) {
|
||||||
return captchaDb.New(data, captcha)
|
dc := NewDwellingCaptcha(captchaDb.GetExpiry())
|
||||||
|
return captchaDb.New(data, dc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Image(id captcha.ID, style string) (*image.Image, error) {
|
func Image(id captcha.ID, style string) (*image.Image, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user