Fix 500 server error when trying to log in with wrong username (#11126)

This commit is contained in:
Phillip Thelen
2019-04-23 18:38:56 +02:00
committed by Matteo Pagliazzi
parent e4eca4b767
commit 821fc1d9c0

View File

@@ -99,7 +99,7 @@ api.loginLocal = {
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'));
if (!user || !user.auth.local.hashed_password) throw new NotAuthorized(res.t('invalidLoginCredentialsLong'));
let isValidPassword;