small bug on login logs

This commit is contained in:
Adolfo Reyna
2025-02-08 07:55:41 -05:00
parent 9f32ab01b8
commit 222d203a57

View File

@@ -203,14 +203,16 @@ DB.getDB.then((DB) => {
const username = req.body.username || req.query.username; const username = req.body.username || req.query.username;
const password = req.body.password || req.query.password || ""; const password = req.body.password || req.query.password || "";
const user = await DB.getUser(username); const user = await DB.getUser(username);
client_logger.capture({ if (!user){
distinctId: 'app_level', client_logger.capture({
event: 'server@'+req.method+'@'+req.originalUrl+'@userNotFound', distinctId: 'app_level',
properties: { event: 'server@'+req.method+'@'+req.originalUrl+'@userNotFound',
username: username, properties: {
} username: username,
}); }
if (!user) return res.json({ status: "user not founded" }); });
return res.json({ status: "user not founded" });
}
// TODO: Also add salt parameter here. // TODO: Also add salt parameter here.
const isSamePassword = await bcrypt.compare(password, user.password); const isSamePassword = await bcrypt.compare(password, user.password);
if (!isSamePassword) return res.json({ status: "incorrect password" }); if (!isSamePassword) return res.json({ status: "incorrect password" });