Advertisement
Guest User

Untitled

a guest
Apr 15th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. UserSchema.pre('save', async function(next){
  2. const user = this
  3. if(user.isModified('password')){
  4. user.password = await bcrypt.hash(user.password, 8)
  5. }
  6. next()
  7. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement