You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// example passport.use(newLocalStrategy(function(username,password,done){User.findOne({username: username},function(err,user){if(err){returndone(err);}if(!user){returndone(null,false);}if(!user.verifyPassword(password)){returndone(null,false);}returndone(null,user);});}));
// In fact, removing return is also effective, and adding return will also cause misunderstandingpassport.use(newLocalStrategy(function(username,password,done){User.findOne({username: username},function(err,user){if(err){done(err);}if(!user){done(null,false);}if(!user.verifyPassword(password)){done(null,false);}done(null,user);});}));
The text was updated successfully, but these errors were encountered:
The return stops the evaluation of the function block. In your example done(null, user) would be called regardless if done was called from the if statements.
The text was updated successfully, but these errors were encountered: