mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-09 06:15:22 +02:00
Update Sequelize where query for User username/email case insensitive
This commit is contained in:
+2
-10
@@ -352,11 +352,7 @@ class User extends Model {
|
|||||||
if (cachedUser) return cachedUser
|
if (cachedUser) return cachedUser
|
||||||
|
|
||||||
const user = await this.findOne({
|
const user = await this.findOne({
|
||||||
where: {
|
where: sequelize.where(sequelize.fn('lower', sequelize.col('username')), username.toLowerCase()),
|
||||||
username: {
|
|
||||||
[sequelize.Op.like]: username
|
|
||||||
}
|
|
||||||
},
|
|
||||||
include: this.sequelize.models.mediaProgress
|
include: this.sequelize.models.mediaProgress
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -377,11 +373,7 @@ class User extends Model {
|
|||||||
if (cachedUser) return cachedUser
|
if (cachedUser) return cachedUser
|
||||||
|
|
||||||
const user = await this.findOne({
|
const user = await this.findOne({
|
||||||
where: {
|
where: sequelize.where(sequelize.fn('lower', sequelize.col('email')), email.toLowerCase()),
|
||||||
email: {
|
|
||||||
[sequelize.Op.like]: email
|
|
||||||
}
|
|
||||||
},
|
|
||||||
include: this.sequelize.models.mediaProgress
|
include: this.sequelize.models.mediaProgress
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user