DEV Community

Discussion on: Building a NodeJS Web App Using PassportJS for Authentication

Collapse
 
meisterjustice profile image
Justice Eziefule

Thank you soo much man. I encountered a lil problem with User.hooks but it's all good now

change
User.hook("beforeCreate", function(user) {
user.password = bcrypt.hashSync(user.password, bcrypt.genSaltSync(10), null);
});

to

User.beforeCreate(function (user, options) {
user.password = bcrypt.hashSync(user.password, bcrypt.genSaltSync(10), null);
});