update
This commit is contained in:
parent
ab4198ca21
commit
af3fa25a14
2 changed files with 4 additions and 1 deletions
|
@ -314,6 +314,9 @@ function csmod.Allow(ip)
|
||||||
local recaptcha_res = ngx.req.get_post_args()["g-recaptcha-response"] or 0
|
local recaptcha_res = ngx.req.get_post_args()["g-recaptcha-response"] or 0
|
||||||
if recaptcha_res ~= 0 then
|
if recaptcha_res ~= 0 then
|
||||||
valid, err = cs.validateCaptcha(recaptcha_res, ngx.var.remote_addr)
|
valid, err = cs.validateCaptcha(recaptcha_res, ngx.var.remote_addr)
|
||||||
|
if err ~= nil then
|
||||||
|
ngx.log(ngx.ERR, "Error while validating captcha: " .. err)
|
||||||
|
end
|
||||||
if valid == true then
|
if valid == true then
|
||||||
ngx.shared.crowdsec_cache:set("captcha_"..ngx.var.remote_addr, "/" , 10, recaptcha.GetStateID(recaptcha._VALIDATED_STATE))
|
ngx.shared.crowdsec_cache:set("captcha_"..ngx.var.remote_addr, "/" , 10, recaptcha.GetStateID(recaptcha._VALIDATED_STATE))
|
||||||
ngx.req.set_method(ngx.HTTP_GET)
|
ngx.req.set_method(ngx.HTTP_GET)
|
||||||
|
|
|
@ -73,7 +73,7 @@ function M.Validate(g_captcha_res, remote_ip)
|
||||||
|
|
||||||
local httpc = http.new()
|
local httpc = http.new()
|
||||||
|
|
||||||
httpc:set_timeout(0.2)
|
httpc:set_timeout(3)
|
||||||
|
|
||||||
local res, err = httpc:request_uri(recaptcha_verify_url, {
|
local res, err = httpc:request_uri(recaptcha_verify_url, {
|
||||||
method = "POST",
|
method = "POST",
|
||||||
|
|
Loading…
Reference in a new issue