summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-07-19 22:46:06 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-07-19 22:46:06 +0200
commitc05e17e4d423904781a1c5c723111c8844d702d6 (patch)
tree33d3cc20ad584c35f7b85662e771a2b71d203907 /src
parent:bug: fix gateway route (diff)
downloadserver-ts-c05e17e4d423904781a1c5c723111c8844d702d6.tar.xz
:bug: fix login route
Diffstat (limited to 'src')
-rw-r--r--src/routes/auth/login.ts18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/routes/auth/login.ts b/src/routes/auth/login.ts

index 1c288716..82cefae8 100644 --- a/src/routes/auth/login.ts +++ b/src/routes/auth/login.ts
@@ -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" } }); }