mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-07 11:22:35 +01:00
🐛 fix login route
This commit is contained in:
parent
247a213eea
commit
c05e17e4d4
@ -47,15 +47,13 @@ router.post(
|
||||
const user = await UserModel.findOne(
|
||||
{ $or: query },
|
||||
{
|
||||
projection: {
|
||||
user_data: {
|
||||
hash: true
|
||||
},
|
||||
id: true,
|
||||
user_settings: {
|
||||
locale: true,
|
||||
theme: true
|
||||
}
|
||||
user_data: {
|
||||
hash: true
|
||||
},
|
||||
id: true,
|
||||
user_settings: {
|
||||
locale: true,
|
||||
theme: true
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -65,7 +63,7 @@ router.post(
|
||||
});
|
||||
|
||||
// the salt is saved in the password refer to bcrypt docs
|
||||
const same_password = await bcrypt.compare(password, user.user_data.hash);
|
||||
const same_password = await bcrypt.compare(password, user.user_data.hash || "");
|
||||
if (!same_password) {
|
||||
throw FieldErrors({ password: { message: req.t("auth:login.INVALID_PASSWORD"), code: "INVALID_PASSWORD" } });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user