From 35c50a3b502d5e434cd682f9560cccb10c618643 Mon Sep 17 00:00:00 2001 From: Sahil Sinha Date: Wed, 25 Feb 2026 02:08:15 +0530 Subject: [PATCH] Fix: Control the behavior only by checking the options parameter. --- server/models/user.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/server/models/user.ts b/server/models/user.ts index f3a92d93ea..426945eca0 100644 --- a/server/models/user.ts +++ b/server/models/user.ts @@ -287,11 +287,7 @@ userSchema.statics.findByEmailOrUsername = async function findByEmailOrUsername( : value.indexOf('@') > -1; // do the case insensitive stuff - if ( - arguments.length === 2 && - typeof options === 'object' && - options.caseInsensitive - ) { + if (options?.caseInsensitive) { const query = isEmail ? { email: value } : { username: value }; const foundUser = await user .findOne(query)