small bug on login logs
This commit is contained in:
18
index.js
18
index.js
@@ -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" });
|
||||||
|
|||||||
Reference in New Issue
Block a user