Fix registration script

This commit is contained in:
Anthony Wang 2021-11-22 20:38:04 -06:00
parent 72283410e4
commit d18817fc0d
Signed by: a
GPG key ID: BC96B00AEC5F2D76

View file

@ -6,12 +6,14 @@ form.addEventListener('submit', (e) => {
const data = new Object()
if (!/^[a-z0-9]+$/.test(username)) return;
for (const s of ['firstname', 'lastname', 'email', 'username', 'password']) {
data[s] = document.getElementsByName(s)[0].value
}
if (/^[a-z0-9]+$/.test(data['username']) === false) {
return
}
console.log(data)
fetch(url, {
@ -20,4 +22,4 @@ form.addEventListener('submit', (e) => {
}).then((response) => {
alert(response.statusText)
})
})
})