Skip to content

Commit 22801d2

Browse files
dblythyflovilmart
authored andcommitted
Ensure we respond with invalid password even if email is unverified (#4708)
1 parent 8380107 commit 22801d2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Routers/UsersRouter.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ export class UsersRouter extends ClassesRouter {
103103
user = results[0];
104104
}
105105

106-
if (req.config.verifyUserEmails && req.config.preventLoginWithUnverifiedEmail && !user.emailVerified) {
107-
throw new Parse.Error(Parse.Error.EMAIL_NOT_FOUND, 'User email is not verified.');
108-
}
109106
return passwordCrypto.compare(password, user.password);
110107
})
111108
.then((correct) => {
@@ -117,7 +114,9 @@ export class UsersRouter extends ClassesRouter {
117114
if (!isValidPassword) {
118115
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Invalid username/password.');
119116
}
120-
117+
if (req.config.verifyUserEmails && req.config.preventLoginWithUnverifiedEmail && !user.emailVerified) {
118+
throw new Parse.Error(Parse.Error.EMAIL_NOT_FOUND, 'User email is not verified.');
119+
}
121120
// handle password expiry policy
122121
if (req.config.passwordPolicy && req.config.passwordPolicy.maxPasswordAge) {
123122
let changedAt = user._password_changed_at;

0 commit comments

Comments
 (0)