From 7aa854ffc4aab21a3917ac335345fa2e7cf70a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emrik=20=C3=96stling?= Date: Mon, 25 Mar 2024 22:18:32 +0100 Subject: [PATCH] more logging --- backend/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/index.js b/backend/index.js index ee9f102..1ba8b7b 100644 --- a/backend/index.js +++ b/backend/index.js @@ -95,7 +95,11 @@ app.post("/register", async (req, res) => { // Check if email already exists let sql = "SELECT * FROM users WHERE email = ?"; let rows = await conn.query(sql, [userEmail]); + if (rows.length > 0) { + console.log( + `User with email ${userEmail} already exists: ${rows[0].toString()}`, + ); // If the account is not active, resend the confirmation email if (!rows[0].active) { sql = "SELECT token FROM confirmations WHERE user_id = ?"; @@ -120,6 +124,7 @@ app.post("/register", async (req, res) => { ); } } else { + res.status(400).send("Account already exists and is active."); } return;