From fabb2ca60618dbf25448329ff47420b6fafb02c7 Mon Sep 17 00:00:00 2001 From: BurnyLlama Date: Sun, 24 Apr 2022 17:34:59 +0200 Subject: [PATCH] Added creation of 'dummy emails' for all newly created accounts... --- routes/auth.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routes/auth.js b/routes/auth.js index 9fef1b1..637bac4 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -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 \ No newline at end of file +export default AUTH