Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Fix captcha HTTP request

Uku Taht7bfd7cc2192f
diff --git a/lib/plausible_web/captcha.ex b/lib/plausible_web/captcha.ex
index b05d607f40..bffde5634a 100644
--- a/lib/plausible_web/captcha.ex
+++ b/lib/plausible_web/captcha.ex
@@ -17,12 +17,18 @@ defmodule PlausibleWeb.Captcha do
res =
HTTPClient.post(
@verify_endpoint,
- [],
- {:form, [{"response", token}, {"secret", secret()}]}
+ [{"Content-Type", "application/x-www-form-urlencoded"}],
+ "response=#{token}&secret=#{secret()}"
)
- json = Jason.decode!(res.body)
- json["success"]
+ case res do
+ {:ok, %Finch.Response{status: 200, body: body}} ->
+ json = Jason.decode!(body)
+ json["success"]
+
+ _ ->
+ false
+ end
else
true
end