Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
generateHash: (password) => {
/* eslint-disable no-sync */
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null)
}
},
Users.addHook("beforeCreate", function(users) {
users.password = bcrypt.hashSync(
users.password,
bcrypt.genSaltSync(10),
null
);
});
userSchema.methods.generateHash = function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};
userSchema.methods.generateHash = function(password) {
var bcrypt = require('bcrypt-nodejs')
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null)
}
function hashPassword (instance) {
var salt = bcrypt.genSaltSync(10);
var hash = bcrypt.hashSync(instance.password, salt);
instance.password = hash;
}