Captcha
How to enable and configure Captcha to protect your community from spam.
We're provide a simple way to integrate captcha into your application to prevent bots from submitting forms. It supports multiple captcha providers and can be easily integrated into your plugin.
VitNode has support for:
- Google reCAPTCHA v2 (checkbox)
- Google reCAPTCHA v2 (invisible)
- Google reCAPTCHA v3
- Cloudflare Turnstile
Configuration
To enable captacha go to our guide Captcha in AdminCP.
Usage
Inside VitNode we're already implemented a captcha into core modules and you can use it in your API.
Backend
Inside your service file, import the CaptchaHelper
and inject it into your service.
Frontend
Component
Inside your form component, create a div with an id of vitnode_captcha
to render the captcha.
Hook
Inside your hook, import the useCaptcha
hook and call the getTokenFromCaptcha
function to get the captcha token and use it in your mutation.
isReady
is a boolean that indicates if the captcha is ready to be used.
Fetcher
Inside your fetcher, add x-vitnode-captcha-token
to the headers.