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:
parent
adf233c2e6
commit
678ffc83ea
@ -25,6 +25,8 @@ router.post(
|
|||||||
const query: any[] = [{ phone: login }];
|
const query: any[] = [{ phone: login }];
|
||||||
if (email) query.push({ email });
|
if (email) query.push({ email });
|
||||||
|
|
||||||
|
console.log(req.body, email);
|
||||||
|
|
||||||
const config = Config.get();
|
const config = Config.get();
|
||||||
|
|
||||||
if (config.login.requireCaptcha && config.security.captcha.enabled) {
|
if (config.login.requireCaptcha && config.security.captcha.enabled) {
|
||||||
@ -42,10 +44,11 @@ router.post(
|
|||||||
|
|
||||||
const user = await UserModel.findOne(
|
const user = await UserModel.findOne(
|
||||||
{ $or: query },
|
{ $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()
|
.exec()
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
console.log(e, query);
|
||||||
throw FieldErrors({ login: { message: req.t("auth:login.INVALID_LOGIN"), code: "INVALID_LOGIN" } });
|
throw FieldErrors({ login: { message: req.t("auth:login.INVALID_LOGIN"), code: "INVALID_LOGIN" } });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user