async function handleSubmit() { var nonce_request = await fetch("https://matrix-reg.test.lauka.dev/_synapse/admin/v1/register", { method: 'GET', redirect: 'follow', mode: "cors" }) var nonce = await nonce_request.json() var username = document.getElementById("username").value var password = document.getElementById("password").value var sharedsecret = document.getElementById("sharedsecret").value var admin = "notadmin" var string = `${nonce.nonce}\0${username}\0${password}\0${admin}` const hash = new jsSHA("SHA-1", "TEXT", { hmacKey : { value : sharedsecret, format: "TEXT" }}) } function HandlePasswordInput() { var info = document.getElementById("password-info") var button = document.getElementById("submit-button") var messages = [] var password = document.getElementById("password").value var passwordrepeat = document.getElementById("password-repeat").value if (password.length < 20) { messages.push("Password must be 20 letters or more.") } if (!(password === passwordrepeat)) { messages.push("Passwords must match.") } if (messages.length == 0) { info.style.display = 'none' button.removeAttribute('disabled') } else if (messages.length == 1) { info.style.display = 'block' info.innerHTML = messages[0] button.setAttribute('disabled','disabled'); } else { info.style.display = 'block' string = messages.join("
") info.innerHTML = string button.setAttribute('disabled','disabled'); } }