1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

🐛 fix login route

This commit is contained in:
Flam3rboy 2021-08-17 20:36:57 +02:00
parent adf233c2e6
commit 678ffc83ea

View File

@ -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" } });
});