reCAPTCHA v3 for Rocket Framework
This crate can help you use reCAPTCHA v3 (v2 is backward compatible) in your Rocket web application.
Configuration
Put your reCAPTCHA keys in Rocket.toml. The html_key is optional, and is only needed to render the front-end script.
[]
= "6Lf6dLIUAAAAAAxghN7nH6m_yuLfHwdD3N7FpanR"
= "6Lf6dLIUAAAAAHdJ4e0nsv-8OpFH-7Oad1XQ95rq"
Usage
Attach ReCaptcha::fairing() to Rocket, and then every route can take a &State<ReCaptcha> to verify tokens with.
extern crate rocket;
use ;
use ;
async
async
reCAPTCHA v2 works the same way. Put the keys under [default.recaptcha.v2], attach ReCaptcha::fairing_v2(), and take a &State<ReCaptcha<V2>> in your routes.
ReCaptcha::verify can also report the client's IP address to Google. See the documentation for an example.
Crates.io
https://crates.io/crates/rocket-recaptcha-v3
Documentation
https://docs.rs/rocket-recaptcha-v3