Fix registration script
This commit is contained in:
parent
72283410e4
commit
d18817fc0d
1 changed files with 5 additions and 3 deletions
|
@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Reference in a new issue