-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaptcha.html
58 lines (55 loc) · 1.64 KB
/
captcha.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<script src="https://www.google.com/recaptcha/enterprise.js?render=6Ld9YygqAAAAAO8CMmH2-XTciOfp0nx95_j2c_h9"></script>
<style>
/* Add some basic styling to the form */
form {
width: 300px;
margin: 40px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<form id="login-form">
<div
class="g-recaptcha"
data-sitekey="6Ld9YygqAAAAAO8CMmH2-XTciOfp0nx95_j2c_h9"
></div>
<br />
<button type="submit">Copy token to clipboard</button>
<br /><br />
<span id="copiedResult" style="display: none">Copied to clipboard</span>
</form>
<script type="text/javascript">
function copyToClipboard(text) {
navigator.clipboard
.writeText(text)
.then(function () {
alert("Token copied to clipboard");
})
.catch(function (error) {
console.error("Failed to copy text: ", error);
});
}
// Add event listener to the form submission
document
.getElementById("login-form")
.addEventListener("submit", function (event) {
event.preventDefault();
grecaptcha.enterprise.ready(async () => {
const token = await grecaptcha.enterprise.execute(
"6Ld9YygqAAAAAO8CMmH2-XTciOfp0nx95_j2c_h9",
{ action: "TOO_MANY_LOGIN_ATTEMPTS" }
);
copyToClipboard(token);
});
});
</script>
</body>
</html>