From 678ffc83eaf626f996317d1ce9ece166d5cbcfd7 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 17 Aug 2021 20:36:57 +0200 Subject: [PATCH] :bug: fix login route --- api/src/routes/auth/login.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/routes/auth/login.ts b/api/src/routes/auth/login.ts index 39ccf69c..a7247485 100644 --- a/api/src/routes/auth/login.ts +++ b/api/src/routes/auth/login.ts @@ -25,6 +25,8 @@ router.post( const query: any[] = [{ phone: login }]; if (email) query.push({ email }); + console.log(req.body, email); + const config = Config.get(); if (config.login.requireCaptcha && config.security.captcha.enabled) { @@ -42,10 +44,11 @@ router.post( const user = await UserModel.findOne( { $or: query }, - { user_data: { hash: true }, id: true, disabled: true, deleted: true, user_settings: { locale: true, theme: true } } + { "user_data.hash": true, id: true, disabled: true, deleted: true, "user_settings.locale": true, "user_settings.theme": true } ) .exec() .catch((e) => { + console.log(e, query); throw FieldErrors({ login: { message: req.t("auth:login.INVALID_LOGIN"), code: "INVALID_LOGIN" } }); });