Skip to content

Commit cff199d

Browse files
committed
Fix: Control the behavior only by checking the options parameter.
1 parent a722ec5 commit cff199d

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

server/models/user.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,7 @@ userSchema.statics.findByEmailOrUsername = async function findByEmailOrUsername(
287287
: value.indexOf('@') > -1;
288288

289289
// do the case insensitive stuff
290-
if (
291-
arguments.length === 2 &&
292-
typeof options === 'object' &&
293-
options.caseInsensitive
294-
) {
290+
if (options?.caseInsensitive) {
295291
const query = isEmail ? { email: value } : { username: value };
296292
const foundUser = await user
297293
.findOne(query)

0 commit comments

Comments
 (0)