Files
server_torii/config/error_page/CAPTCHA.html
2025-02-15 02:40:20 -05:00

84 lines
2.3 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CAPTCHA - ⛩Server Torii</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f9f9f9;
}
.container {
text-align: left;
max-width: 600px;
}
.icon svg {
width: 60px;
height: 60px;
stroke: #333;
}
.message {
font-size: 24px;
font-weight: bold;
color: #333;
}
.description {
margin-top: 10px;
color: #666;
}
.footer {
margin-top: 30px;
font-size: 12px;
color: #999;
}
.footer a {
color: red;
text-decoration: none;
}
</style>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
<script>
function onSubmit(token) {
let reqBody = "h-captcha-response=" + token;
let httpRequest = new XMLHttpRequest();
httpRequest.open("POST", "/torii/captcha", true);
httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
httpRequest.send(reqBody);
httpRequest.onreadystatechange = () => {
if (httpRequest.readyState == 4 && httpRequest.status == 200) {
let text = httpRequest.responseText;
switch (text) {
case "good":
window.location.reload();
break;
case "bad":
alert("Bad CAPTCHA, please refresh the page and try again.\n"
+ "您未能通过人机验证,请刷新页面后重试。");
break;
default:
alert("Unexpected error occurred, please refresh the page and try again.\n"
+ "发生了意料之外的错误,请刷新页面后重试。");
}
}
}
}
</script>
</head>
<body>
<div class="container">
<div class="message">Checking that you are not a robot</div>
<div class="description"><div class="h-captcha" data-sitekey="" data-callback="onSubmit"></div></div>
<div class="footer">
Security powered by <a href="https://github.com/Rayzggz/server_torii">Server Torii</a>
</div>
</div>
</body>
</html>