народ а как дернуть из монгодб юзера в мидлвере пасспорта? вот функция
passport.use(new LocalStrategy(
{ usernameField: 'email' },
(email, password, done) => {
console.log('Inside local strategy callback')
const candidate = User.findOne({email: 'email'})
console.log(candidate)
// console.log(candidate)
// here is where you make a call to the database
// to find the user based on their username or email address
// for now, we'll just pretend we found that it was users[0]
if(email ===
candidate.email && password === candidate.password) {
console.log('Local strategy returned true')
return done(null, candidate)
} else {
console.log('wrong')
}
}
));