captcha: fix page load

This commit is contained in:
undefined committed 2021-04-03 00:35:24 +08:00
1 parent 653d18b57b
commit 6317c9057f
2 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/recaptcha", "name": "@hydrooj/recaptcha",
"version": "1.0.0", "version": "1.0.1",
"description": "Google reCAPTCHA", "description": "Google reCAPTCHA",
"main": "package.json", "main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",
@@ -1,7 +1,7 @@
(() => { (() => {
const { AutoloadPage } = window.Hydro; const { NamedPage } = window.Hydro;
const page = new AutoloadPage('recaptcha', () => { const page = new NamedPage('user_register', () => {
function captcha(event) { function captcha(event) {
event.preventDefault(); event.preventDefault();
grecaptcha.ready(function () { grecaptcha.ready(function () {
@@ -11,7 +11,8 @@
}); });
}); });
} }
document.getElementById('submit').onclick = captcha; const element = document.getElementById('submit');
if (element) element.onclick = captcha;
}); });
window.Hydro.extraPages.push(page); window.Hydro.extraPages.push(page);