Skip to content

Instantly share code, notes, and snippets.

@RubyRonin
Created October 23, 2015 17:39
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 RubyRonin/5630304b9d85af0a55e7 to your computer and use it in GitHub Desktop.
Save RubyRonin/5630304b9d85af0a55e7 to your computer and use it in GitHub Desktop.
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