This commit is contained in:
alteredCoder 2022-01-26 17:36:44 +01:00
parent ab4198ca21
commit af3fa25a14
2 changed files with 4 additions and 1 deletions

View file

@ -314,6 +314,9 @@ function csmod.Allow(ip)
local recaptcha_res = ngx.req.get_post_args()["g-recaptcha-response"] or 0
if recaptcha_res ~= 0 then
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
ngx.shared.crowdsec_cache:set("captcha_"..ngx.var.remote_addr, "/" , 10, recaptcha.GetStateID(recaptcha._VALIDATED_STATE))
ngx.req.set_method(ngx.HTTP_GET)

View file

@ -73,7 +73,7 @@ function M.Validate(g_captcha_res, remote_ip)
local httpc = http.new()
httpc:set_timeout(0.2)
httpc:set_timeout(3)
local res, err = httpc:request_uri(recaptcha_verify_url, {
method = "POST",