A lightweight, secure CAPTCHA widget for any website.
Add to your HTML:
<script src="https://captchatool.com/captcha-widget.min.js" defer></script>
<div data-captcha></div>
On form submit, verify server-side by checking validatedCaptcha
:
if (empty($_POST['validatedCaptcha'])) {
exit('CAPTCHA failed or not completed.');
}
if (!req.body.validatedCaptcha) {
return res.status(400).send('CAPTCHA failed or not completed.');
}
if not request.form.get('validatedCaptcha'):
return 'CAPTCHA failed or not completed.', 400
if (validatedCaptcha == null || validatedCaptcha.isEmpty()) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("CAPTCHA failed or not completed.");
}
if r.FormValue("validatedCaptcha") == "" {
http.Error(w, "CAPTCHA failed or not completed.", http.StatusBadRequest)
}
if validated_captcha.is_empty() {
return Err((StatusCode::BAD_REQUEST, "CAPTCHA failed or not completed."));
}
if params[:validatedCaptcha].blank?
render plain: "CAPTCHA failed or not completed.", status: :bad_request
end
if (string.IsNullOrWhiteSpace(Request.Form["validatedCaptcha"])) {
return BadRequest("CAPTCHA failed or not completed.");
}
Endpoint | Description |
---|---|
/generate | Returns captchaId & question |
/validate | POST to validate user's answer |
Need help? Contact hello@captchatool.com