Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
At least attempt to handle turnstile errors
  • Loading branch information
regalijan committed Nov 11, 2023
1 parent cc8c03a commit 92e6f2e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion app/routes/report.tsx
Expand Up @@ -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{" "}
Expand Down Expand Up @@ -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>
</>
);
}

0 comments on commit 92e6f2e

Please sign in to comment.