Created
November 22, 2012 16:05
-
-
Save shinecita/4131876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.post('/signin', function (req, res) { | |
User | |
.findOne({ email: req.body.email }, function(err, user) { | |
if(user && user.__password.salt) { | |
pass.hash(req.body.password, user.__password.salt, function(err, hash) { | |
if(user.__password.hash == hash) { | |
req.session._userId = user._id; | |
res.json(user); | |
} else { | |
res.send(401); | |
} | |
}); | |
if(err) { | |
//do something | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment