Skip to content

Instantly share code, notes, and snippets.

@robwormald
Created February 11, 2014 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robwormald/8944501 to your computer and use it in GitHub Desktop.
Save robwormald/8944501 to your computer and use it in GitHub Desktop.
beforeUpdate: function(values, next) {
if (values.password) {
hashPassword(values, next);
}
else {
User.findOne(values.id).done(function(err, user) {
if (err) {
next(err);
}
else {
values.password = user.password;
next();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment