diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-09 14:00:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-09 14:00:34 +0100 |
commit | c4a1811ea888fa98fe7cd6932d82b3d63d366f28 (patch) | |
tree | c090e28b84f02dbdc5425497fab6fd357b7b88ee /server/models/account | |
parent | 41ee83423c234fdb5f6d09f21e3c5fe3ae6a192c (diff) | |
download | PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.tar.gz PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.tar.zst PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.zip |
Use lower instead of ilike to login users
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/user.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 27262af42..4c2c5e278 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { FindOptions, literal, Op, QueryTypes } from 'sequelize' | 1 | import { FindOptions, literal, Op, QueryTypes, where, fn, col } from 'sequelize' |
2 | import { | 2 | import { |
3 | AfterDestroy, | 3 | AfterDestroy, |
4 | AfterUpdate, | 4 | AfterUpdate, |
@@ -465,7 +465,11 @@ export class UserModel extends Model<UserModel> { | |||
465 | 465 | ||
466 | const query = { | 466 | const query = { |
467 | where: { | 467 | where: { |
468 | [ Op.or ]: [ { username: { [ Op.iLike ]: username } }, { email } ] | 468 | [ Op.or ]: [ |
469 | where(fn('lower', col('username')), fn('lower', username)), | ||
470 | |||
471 | { email } | ||
472 | ] | ||
469 | } | 473 | } |
470 | } | 474 | } |
471 | 475 | ||