From be79a029fe966942418d7def4a39a0e3bc32f201 Mon Sep 17 00:00:00 2001 From: Jose Vera Date: Wed, 2 Mar 2022 22:27:01 -0500 Subject: [PATCH] Error when account does not exist --- controllers/authentication.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/authentication.js b/controllers/authentication.js index f7b44fb..c011b96 100644 --- a/controllers/authentication.js +++ b/controllers/authentication.js @@ -26,7 +26,7 @@ async function readJWT(token) { async function signIn(email, password) { let account = await orm.models.accounts.findOne({ where: { email } }); - if (account.dataValues) { + if (account && account.dataValues) { account = account.dataValues; const inputPassword = crypto.createHash('sha256').update(password + process.env.APP_SALT).digest('hex'); if (account.password === inputPassword) {