summary refs log tree commit diff
path: root/api/src/routes/auth/login.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-27 11:10:42 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-27 11:10:42 +0200
commit0ecc5d8c0e353676e9f5bdbc724bb33572d3b572 (patch)
tree75040e26406762efea9daf7e8475e3834495c462 /api/src/routes/auth/login.ts
parent:sparkles: use RelationId (diff)
downloadserver-0ecc5d8c0e353676e9f5bdbc724bb33572d3b572.tar.xz
:construction: api
Diffstat (limited to 'api/src/routes/auth/login.ts')
-rw-r--r--api/src/routes/auth/login.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/api/src/routes/auth/login.ts b/api/src/routes/auth/login.ts

index 579a097e..c0acad4e 100644 --- a/api/src/routes/auth/login.ts +++ b/api/src/routes/auth/login.ts
@@ -21,9 +21,6 @@ router.post( async (req: Request, res: Response) => { const { login, password, captcha_key, undelete } = req.body; const email = adjustEmail(login); - const query: any[] = [{ phone: login }]; - if (email) query.push({ email }); - console.log(req.body, email); const config = Config.get(); @@ -41,11 +38,10 @@ router.post( // TODO: check captcha } - const user = await User.findOneOrFail( - { $or: query }, - { "data.hash": true, id: true, disabled: true, deleted: true, "settings.locale": true, "settings.theme": true } - ).catch((e) => { - console.log(e, query); + const user = await User.findOneOrFail({ + where: [{ phone: login }, { email: login }], + select: ["data", "id", "disabled", "deleted", "settings"] + }).catch((e) => { throw FieldErrors({ login: { message: req.t("auth:login.INVALID_LOGIN"), code: "INVALID_LOGIN" } }); });