Skip to content

Commit a5c68ce

Browse files
authored
Merge pull request #3932 from SinhaS12/fix/User-Model
Fix fragile arguments.length check in findByEmailOrUsername
2 parents 3363148 + 86ae359 commit a5c68ce

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

client/modules/User/components/AccountForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export function AccountForm() {
148148
<Field name="currentPassword">
149149
{(field) => (
150150
<p className="form__field">
151-
<label htmlFor="current password" className="form__label">
151+
<label htmlFor="currentPassword" className="form__label">
152152
{t('AccountForm.CurrentPassword')}
153153
</label>
154154
<input
@@ -172,7 +172,7 @@ export function AccountForm() {
172172
<Field name="newPassword">
173173
{(field) => (
174174
<p className="form__field">
175-
<label htmlFor="new password" className="form__label">
175+
<label htmlFor="newPassword" className="form__label">
176176
{t('AccountForm.NewPassword')}
177177
</label>
178178
<input

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)