db.js
/**
 * Compare a user-inputted password to a hashed password and return a boolean value.
 * @param {String} password String of raw user input password to be compared
 * @param {String} hashed String of hashed password
 * @returns A boolean, true for correct passwords, false for incorrect passwords or other errors
 */
Compare a user-inputted password to a hashed password and return a boolean value.
@param {String} password String of raw user input password to be compared
@param {String} hashed String of hashed password
@returns A boolean, true for correct passwords, false for incorrect passwords or other errors
Compare a user - inputted password to a hashed password and return a boolean value . @param { String } password String of raw user input password to be compared @param { String } hashed String of hashed password @returns A boolean true for correct passwords false for incorrect passwords or other errors
function comparePassword(password, hashed) {
  return new Promise(function(resolve, reject) {
      bcrypt.compare(password, hashed, function(err, res) {
          if (err) {
               reject(false);
          } else {
               resolve(true);
          }
      });
  });
}
function comparePassword ( password , hashed ) { return new Promise ( function ( resolve , reject ) { bcrypt . compare ( password , hashed , function ( err , res ) { if ( err ) { reject ( false ) ; } else { resolve ( true ) ; } } ) ; } ) ; }
Compare a user-inputted password to a hashed password and return a boolean value.
Compare a user - inputted password to a hashed password and return a boolean value .