How to use the bcrypt.compareAsync function in bcrypt

To help you get started, we’ve selected a few bcrypt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github calzoneman / sync / src / controller / account.js View on Github external
if (requirePassword) {
            if (!password) {
                throw new InvalidRequestError('Password required');
            }

            const user = await this.accountDB.getByName(name);

            if (!user) {
                throw new InvalidRequestError('User does not exist');
            }

            // For legacy reasons, the password was truncated to 100 chars.
            password = password.substring(0, 100);

            if (!await bcrypt.compareAsync(password, user.password)) {
                throw new InvalidRequestError('Invalid password');
            }
        }

        await this.accountDB.updateByName(name, fields);
    }
}
github catamphetamine / webapp / backend / code / password-service / api / password.js View on Github external
function check_password(password, hashed_password)
{
	return bcrypt.compareAsync(password, hashed_password)
}
github catamphetamine / webapp / code / password-service / api / password.js View on Github external
function check_password(password, hashed_password)
{
	return bcrypt.compareAsync(password, hashed_password)
}
github sirodoht / aspen / back / models / user.model.js View on Github external
User.prototype.validPassword = function (pwd) {
    return bcrypt.compareAsync(pwd, this.password)
      .then(function (isMatch) {
        return isMatch;
      });
  };
github CommonGarden / Grow-IoT / packages / mongoose-models / lib / auth / password.js View on Github external
static comparePassword(password, hashedPassword) {
    password = this.getPasswordString(password);
    return bcrypt.compareAsync(password, hashedPassword);
  }
}