mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
recaptcha: init support
This commit is contained in:
1 parent
f58db3eeb2
commit
8d3dc160a8
11 files changed
+80
-8
No files matched your search
@@ -0,0 +1,18 @@
|
||||
(() => {
|
||||
const { AutoloadPage } = window.Hydro;
|
||||
|
||||
const page = new AutoloadPage('recaptcha', () => {
|
||||
function captcha(event) {
|
||||
event.preventDefault();
|
||||
grecaptcha.ready(function () {
|
||||
grecaptcha.execute(UiContext.recaptchaKey, { action: 'submit' }).then(function (token) {
|
||||
document.getElementById('_captcha').value = token;
|
||||
document.getElementById('_submit').click();
|
||||
});
|
||||
});
|
||||
}
|
||||
document.getElementById('submit').onclick = captcha;
|
||||
});
|
||||
|
||||
window.Hydro.extraPages.push(page);
|
||||
})();
|
||||
Reference in new issue
Block a user