aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-09 14:00:34 +0100
committerChocobozzz <me@florianbigard.com>2020-01-09 14:00:34 +0100
commitc4a1811ea888fa98fe7cd6932d82b3d63d366f28 (patch)
treec090e28b84f02dbdc5425497fab6fd357b7b88ee /server
parent41ee83423c234fdb5f6d09f21e3c5fe3ae6a192c (diff)
downloadPeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.tar.gz
PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.tar.zst
PeerTube-c4a1811ea888fa98fe7cd6932d82b3d63d366f28.zip
Use lower instead of ilike to login users
Diffstat (limited to 'server')
-rw-r--r--server/models/account/user.ts8
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 @@
1import { FindOptions, literal, Op, QueryTypes } from 'sequelize' 1import { FindOptions, literal, Op, QueryTypes, where, fn, col } from 'sequelize'
2import { 2import {
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