Di sini Anda dapat membaca tentang strategi lokal, dan di sini tentang mengkonfigurasi.
Strategi lokal Anda akan terlihat seperti ini:
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');
}
});
});
}));