Add check for the existence of user's password before attempting to authenticate

This commit is contained in:
Chester Sng
2019-03-22 19:30:00 +08:00
parent 23cc2b9d21
commit 3e45f5af41

View File

@@ -98,6 +98,9 @@ api.loginLocal = {
// load the entire user because we may have to save it to convert the password to bcrypt
let user = await User.findOne(login).exec();
// if user is using social login, then user will not have a hashed_password stored
if (!user.auth.local.hashed_password) throw new NotAuthorized(res.t('invalidLoginCredentialsLong'));
let isValidPassword;
if (!user) {