On this Passportjs.org page, the documentation gives an example of using a LocalStrategy, and within the LocalStrategy, it calls a function:
User.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) {
return done(null, false, { message: 'Incorrect username.' });
}
if (!user.validPassword(password)) {
return done(null, false, { message: 'Incorrect password.' });
}
return done(null, user);
});
Now, I'm seeing this "User
" object crop up in multiple places, such as in the documentation for the passport-windowsauth strategy, where the following function is used in an example:
User.findOrCreate()
So now I'm wondering if I'm crazy.
Is this 'User' object and its functions some existing framework or set of functions, or are these just examples of your own home-grown function for finding a user?