Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
passport.use('custom-login', new Custom(function (req, done) {
var email = req.param('email'),
pw = req.param('password');
User.findOne({"local.email": email}, function (err, usr) {
if (err){
console.log(err);
return done(err);
}
if (!usr)
{
return done(null, false, req.flash('loginMessage', 'BITCH PLEASE: Invalid credentials, please try again.'));
}
if (!usr.validPassword(pw))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment