Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
C4illin committed Mar 25, 2024
1 parent 8a114b5 commit 7aa854f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ?";
Expand All @@ -120,6 +124,7 @@ app.post("/register", async (req, res) => {
);
}
} else {

res.status(400).send("Account already exists and is active.");
}
return;
Expand Down

0 comments on commit 7aa854f

Please sign in to comment.