From 247a213eea6e694cfb754d71ae4752ffb43ef6fe Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Mon, 19 Jul 2021 22:45:58 +0200 Subject: :bug: fix gateway route --- src/routes/gateway.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/routes/gateway.ts b/src/routes/gateway.ts index 7e8146df..f2bc5b34 100644 --- a/src/routes/gateway.ts +++ b/src/routes/gateway.ts @@ -5,7 +5,7 @@ const router = Router(); router.get("/", (req: Request, res: Response) => { const { endpoint } = Config.get().gateway; - res.send({ url: endpoint || process.env.GATEWAY || "ws://localhost:3002" }); + res.json({ url: endpoint || process.env.GATEWAY || "ws://localhost:3002" }); }); export default router; -- cgit 1.5.1 From c05e17e4d423904781a1c5c723111c8844d702d6 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Mon, 19 Jul 2021 22:46:06 +0200 Subject: :bug: fix login route --- src/routes/auth/login.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src') 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" } }); } -- cgit 1.5.1