Added creation of 'dummy emails' for all newly created accounts...

main
BurnyLlama 2022-04-24 17:34:59 +02:00
parent 26636d5f2f
commit fabb2ca606
1 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ AUTH.post('/register', async (req, res) => {
delete valid[captcha]
// Does the username match the requirements?
if (!(/^(?=[a-zA-Z0-9]{2,20}$).*$/.test(username)))
if (!(/^\w{2,20}$/.test(username)))
return(res.send("Username does not match the requirements"))
if ((await glauth.query("SELECT * FROM users WHERE name = $1::text", [ username ])).rowCount)
@ -52,8 +52,8 @@ AUTH.post('/register', async (req, res) => {
hash => {
const hexHash = hash2hex(hash)
glauth.query(
"INSERT INTO users(name, primarygroup, passbcrypt, qam_pass) VALUES($1::text, 0, $2::text, $3::text)",
[ username, hexHash, hash ]
"INSERT INTO users(name, mail, primarygroup, passbcrypt, qam_pass) VALUES($1::text, $2::text, 0, $3::text, $4::text)",
[ username, `${username}@qwik.space`, hexHash, hash ]
).then(
() => res.send("Account registered!")
).catch(
@ -156,4 +156,4 @@ AUTH.get('/captcha', async (req, res) => {
})
export default AUTH
export default AUTH