tag1
This commit is contained in:
44
public/index.html
Normal file
44
public/index.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.png">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<style>
|
||||
body {
|
||||
|
||||
}
|
||||
</style>
|
||||
<script src="https://www.recaptcha.net/recaptcha/api.js?render=6Le0CJwfAAAAAGk0J6aDngi7Dya-b0qyFRdIf6Wu"></script>
|
||||
<script type="text/javascript">
|
||||
const CAPTCHA_CLIENT_SECRET = "6Le0CJwfAAAAAGk0J6aDngi7Dya-b0qyFRdIf6Wu";
|
||||
window.onload = () => {
|
||||
document.querySelector('button').addEventListener('click', () => {
|
||||
grecaptcha.execute(CAPTCHA_CLIENT_SECRET, {action: 'homepage'}).then(function (token) {
|
||||
console.log('客户端token:' + token);
|
||||
fetch('/recaptcha/validate?token=' + token, {
|
||||
method: 'GET'
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
response.json().then(message => {
|
||||
console.log('服务端验证');
|
||||
console.log(message);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color: #dddddd;">
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
||||
Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user