From 222d203a575b73260fba0ecfd57b291ca11a6103 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Sat, 8 Feb 2025 07:55:41 -0500 Subject: [PATCH] small bug on login logs --- index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 0ba00d4..9431656 100644 --- a/index.js +++ b/index.js @@ -203,14 +203,16 @@ DB.getDB.then((DB) => { const username = req.body.username || req.query.username; const password = req.body.password || req.query.password || ""; const user = await DB.getUser(username); - client_logger.capture({ - distinctId: 'app_level', - event: 'server@'+req.method+'@'+req.originalUrl+'@userNotFound', - properties: { - username: username, - } - }); - if (!user) return res.json({ status: "user not founded" }); + if (!user){ + client_logger.capture({ + distinctId: 'app_level', + event: 'server@'+req.method+'@'+req.originalUrl+'@userNotFound', + properties: { + username: username, + } + }); + return res.json({ status: "user not founded" }); + } // TODO: Also add salt parameter here. const isSamePassword = await bcrypt.compare(password, user.password); if (!isSamePassword) return res.json({ status: "incorrect password" });