Här du kan läsa om lokala strategier och här om konfigurering.
Din lokala strategi bör se ut så här:
passport.use(new LocalStrategy({
emailField: 'email',
passwordField: 'passw',
},
function (emailField, passwordField, done) {
process.nextTick(function () {
db.collection(dbCollection, function (error, collection) {
if (!error) {
collection.findOne({
'email': [email protected]
'password': silvester // use there some crypto function
}, function (err, user) {
if (err) {
return done(err);
}
if (!user) {
console.log('this email does not exist');
return done(null, false);
}
return done(null, user);
});
} else {
console.log(5, 'DB error');
}
});
});
}));