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"
|
||||
)
|
||||
|
||||
var captchaDb captcha.InMemoryCaptchaDB = captcha.InMemoryCaptchaDB{
|
||||
DB: make(map[captcha.ID]captcha.Captcha)}
|
||||
var captchaDb captcha.CaptchaDB
|
||||
|
||||
func Init(expiry time.Duration) {
|
||||
captchaDb.SetExpiry(expiry)
|
||||
captchaDb = captcha.NewInMemoryCaptchaDB(expiry)
|
||||
}
|
||||
|
||||
func New(data string, captcha captcha.Captcha) (captcha.Captcha, captcha.ID) {
|
||||
return captchaDb.New(data, captcha)
|
||||
func New(data string) (captcha.Captcha, captcha.ID) {
|
||||
dc := NewDwellingCaptcha(captchaDb.GetExpiry())
|
||||
return captchaDb.New(data, dc)
|
||||
}
|
||||
|
||||
func Image(id captcha.ID, style string) (*image.Image, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user