fix: do not throw if password passed into isPasswordCorrect is invalid, just return false

This commit is contained in:
Julian Lam
2022-08-05 13:42:02 -04:00
parent 342cca35c1
commit 287f4c2c41

View File

@@ -26,7 +26,12 @@ module.exports = function (User) {
hashedPassword = '';
}
User.isPasswordValid(password, 0);
try {
User.isPasswordValid(password, 0);
} catch (e) {
return false;
}
await User.auth.logAttempt(uid, ip);
const ok = await Password.compare(password, hashedPassword, !!parseInt(shaWrapped, 10));
if (ok) {