form: add captcha regen button

lots of false negatives so this is a solution for now.

Also the registering of each discord command is now logged for debugging
purposes.
This commit is contained in:
Harvey Tindall
2022-01-26 22:14:16 +00:00
parent 15e5564b12
commit 4b02960fd1
4 changed files with 23 additions and 14 deletions
+7 -1
View File
@@ -271,7 +271,7 @@ let captchaVerified = false;
let captchaID = "";
let captchaInput = document.getElementById("captcha-input") as HTMLInputElement;
if (window.captcha) {
const genCaptcha = () => {
_get("/captcha/gen/"+window.code, null, (req: XMLHttpRequest) => {
if (req.readyState == 4) {
if (req.status == 200) {
@@ -279,9 +279,15 @@ if (window.captcha) {
document.getElementById("captcha-img").innerHTML = `
<img class="w-100" src="${window.location.toString().substring(0, window.location.toString().lastIndexOf("/invite"))}/captcha/img/${window.code}/${captchaID}"></img>
`;
captchaInput.value = "";
}
}
});
};
if (window.captcha) {
genCaptcha();
(document.getElementById("captcha-regen") as HTMLSpanElement).onclick = genCaptcha;
const input = document.querySelector("input[type=submit]") as HTMLInputElement;
const checkbox = document.getElementById("captcha-success") as HTMLSpanElement;
captchaInput.onkeyup = () => _post("/captcha/verify/" + window.code + "/" + captchaID + "/" + captchaInput.value, null, (req: XMLHttpRequest) => {