Expiration time now being get from CaptchaDB.
This commit is contained in:
parent
c5d159531c
commit
4af8d67299
@ -6,20 +6,16 @@ import (
|
|||||||
"justcaptcha/internal/captcha"
|
"justcaptcha/internal/captcha"
|
||||||
"justcaptcha/pkg/server"
|
"justcaptcha/pkg/server"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CaptchaHandlers struct {
|
type CaptchaHandlers struct{}
|
||||||
ExpireIn time.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(expiration time.Duration) *CaptchaHandlers {
|
func New() *CaptchaHandlers {
|
||||||
return &CaptchaHandlers{
|
return &CaptchaHandlers{}
|
||||||
ExpireIn: expiration}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *CaptchaHandlers) New(w http.ResponseWriter, r *http.Request) {
|
func (h *CaptchaHandlers) New(w http.ResponseWriter, r *http.Request) {
|
||||||
dc := captcha.NewDwellingCaptcha(h.ExpireIn)
|
dc := captcha.NewDwellingCaptcha(captcha.GetExpireInterval())
|
||||||
_, id := captcha.New(r.RemoteAddr, dc)
|
_, id := captcha.New(r.RemoteAddr, dc)
|
||||||
|
|
||||||
fmt.Fprint(w, id)
|
fmt.Fprint(w, id)
|
||||||
|
Loading…
Reference in New Issue
Block a user