function Strategy(options, verify) { if (typeof options == 'function') { verify = options; options = {}; } if (!verify) { throw new TypeError('LocalStrategy requires a verify callback'); } this._usernameField = options.usernameField || 'username'; this._passwordField = options.passwordField || 'password'; passport.Strategy.call(this); this.name = 'local'; this._verify = verify; this._passReqToCallback = options.passReqToCallback; }
n/a
function Strategy() { }
n/a
function Strategy() { }
n/a
function Strategy() { }
n/a
authenticate = function (req, options) { throw new Error('Strategy#authenticate must be overridden by subclass'); }
...
return done(null, user);
});
}
));
#### Authenticate Requests
Use `passport.authenticate()`, specifying the `'local'` strategy, to
authenticate requests.
For example, as route middleware in an [Express](http://expressjs.com/)
application:
app.post('/login',
passport.authenticate('local', { failureRedirect: '/login' }),
...
lookup = function (obj, field) { if (!obj) { return null; } var chain = field.split(']').join('').split('['); for (var i = 0, len = chain.length; i < len; i++) { var prop = obj[chain[i]]; if (typeof(prop) === 'undefined') { return null; } if (typeof(prop) !== 'object') { return prop; } obj = prop; } return null; }
n/a