You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i took a look at where getUD is defined(getUD.js),
and you're resolving the promise with the response that comes back from the sql query.
this response is always a massive object, and your password is actually hidden inside the .rows property of this object, which is an array with objects inside it that represent the rows returned by your sql query.
dbPassword here isnt your database password, its an object with the value you want nested inside 😄
I've rewritten this to access the password and use it to resolve the response.
const getUD = (username, password) => {
return new Promise((resolve, reject) => {
dbConnection
.query(`SELECT password FROM login WHERE username= '${username}';`)
.then(sqlresponse => {
console.log('response from password sql query', sqlresponse);
//this is a massive object and you want the .rows property
console.log('password is: ',sqlresponse.rows[0].password);
resolve(sqlresponse.rows[0].password);
})
.catch(err => reject(err));
});
};
The text was updated successfully, but these errors were encountered:
In handler.js line 110-124, getUD is being called, but dbPassword was not what you were expecting it to be(hashed password from the database).
i took a look at where getUD is defined(getUD.js),
and you're resolving the promise with the response that comes back from the sql query.
this response is always a massive object, and your password is actually hidden inside the .rows property of this object, which is an array with objects inside it that represent the rows returned by your sql query.
dbPassword here isnt your database password, its an object with the value you want nested inside 😄
I've rewritten this to access the password and use it to resolve the response.
The text was updated successfully, but these errors were encountered: