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 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" });
|
||||
|
||||
Reference in New Issue
Block a user