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 | |
parent | 41ee83423c234fdb5f6d09f21e3c5fe3ae6a192c (diff) | |
download | PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.tar.gz PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.tar.zst PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.zip |
Use lower instead of ilike to login users
-rwxr-xr-x | scripts/generate-code-contributors.ts | 2 | ||||
-rw-r--r-- | server/models/account/user.ts | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.ts index 5c6620f7d..f1922a20e 100755 --- a/scripts/generate-code-contributors.ts +++ b/scripts/generate-code-contributors.ts | |||
@@ -169,7 +169,7 @@ function getZanataContributors () { | |||
169 | 169 | ||
170 | function getContributorsBlacklist () { | 170 | function getContributorsBlacklist () { |
171 | return { | 171 | return { |
172 | 'Florian Bigard': true, | 172 | 'Bigard Florian': true, |
173 | 'chocobozzz': true, | 173 | 'chocobozzz': true, |
174 | 'Rigel': true | 174 | 'Rigel': true |
175 | } | 175 | } |
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 | ||