Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UserSchema.pre('save', async function(next){
- const user = this
- if(user.isModified('password')){
- user.password = await bcrypt.hash(user.password, 8)
- }
- next()
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement