diff --git a/internal/captcha/instance.go b/internal/captcha/instance.go index 1440647..b695b52 100644 --- a/internal/captcha/instance.go +++ b/internal/captcha/instance.go @@ -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) {