From: Chocobozzz Date: Thu, 9 Jan 2020 13:00:34 +0000 (+0100) Subject: Use lower instead of ilike to login users X-Git-Tag: v2.1.0-rc.1~54 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c4a1811ea888fa98fe7cd6932d82b3d63d366f28;p=oweals%2Fpeertube.git Use lower instead of ilike to login users --- 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 () { function getContributorsBlacklist () { return { - 'Florian Bigard': true, + 'Bigard Florian': true, 'chocobozzz': true, 'Rigel': true } 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 @@ -import { FindOptions, literal, Op, QueryTypes } from 'sequelize' +import { FindOptions, literal, Op, QueryTypes, where, fn, col } from 'sequelize' import { AfterDestroy, AfterUpdate, @@ -465,7 +465,11 @@ export class UserModel extends Model { const query = { where: { - [ Op.or ]: [ { username: { [ Op.iLike ]: username } }, { email } ] + [ Op.or ]: [ + where(fn('lower', col('username')), fn('lower', username)), + + { email } + ] } }