mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
17 lines
537 B
JavaScript
17 lines
537 B
JavaScript
import { addPage, NamedPage } from '@hydrooj/ui-default';
|
|
/* global grecaptcha */
|
|
|
|
addPage(new NamedPage('user_register', () => {
|
|
function captcha(event) {
|
|
event.preventDefault();
|
|
grecaptcha.ready(() => {
|
|
grecaptcha.execute(UiContext.recaptchaKey, { action: 'submit' }).then((token) => {
|
|
document.getElementById('_captcha').value = token;
|
|
document.getElementById('_submit').click();
|
|
});
|
|
});
|
|
}
|
|
const element = document.getElementById('submit');
|
|
if (element) element.onclick = captcha;
|
|
}));
|