diff --git a/app/routes/report.tsx b/app/routes/report.tsx index 1e3b8af..03ce4c8 100644 --- a/app/routes/report.tsx +++ b/app/routes/report.tsx @@ -319,7 +319,11 @@ export default function () { <Textarea id="description" maxLength={512} /> </FormControl> <br /> - <div className="cf-turnstile" data-sitekey={site_key}></div> + <div + className="cf-turnstile" + data-error-callback="onTurnstileError" + data-sitekey={site_key} + ></div> <br /> <Text> By submitting this form, you agree to the{" "} @@ -355,6 +359,25 @@ export default function () { </CircularProgress> </HStack> </Container> + <script> + {` + function onTurnstileError(code) { + const messages = { + 110500: "Your browser is too old to complete the captcha, please update it.", + 110510: "Something unexpected happened, please try disabling all extensions and refresh the page. If this does not solve the problem, use a different browser.", + 110600: "Failed to solve the captcha, please refresh the page to try again.", + 200010: "Invalid cache, please clear your cache and site data in your browser's settings.", + 200100: "Your device's clock is wrong, please fix it.", + }; + + const message = messages[code]; + + alert(message ?? \`Unknown error when solving captcha. Error \${code}\`); + + return true; + } + `} + </script> </> ); }