Skip to content

Instantly share code, notes, and snippets.

@deedubs
Created November 28, 2012 20:45
Show Gist options
  • Save deedubs/4164315 to your computer and use it in GitHub Desktop.
Save deedubs/4164315 to your computer and use it in GitHub Desktop.
User.newPassword = function(user, currentUser, done) {
pass.hash(password, function(err, salt, hash) {
currentUser.__password = {
salt: salt,
hash: hash
}
currentUser.updatedAt = new Date();
User
.save(currentUser, done);
});
}
router.post('/newPassword', function (req, res) {
User.newPassword(req.currentUser, req.body.password, function (err) {
res.send(200);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment