Req.body contains the form data (fields with names), and they are inserted into the Local-login passport.
My login form has three companyId fields, an email address and a password.
passport.use('local-login', new LocalStrategy({ usernameField : 'email', passwordField : 'password', passReqToCallback : true }, function(req, email, password, done) { if (email){ email = email.toLowerCase(); var id = db.generateHash(email,'sha256',10); // here i get to companyId for the body to look at the Company users Table var table = "Users-" + req.body.companyId; db.getOneScan(table, "id", id, null, function(err,user){.....} // if user exist in data base check password is Valid and return user }
I know this is a little late, but I hope this helps someone.
source share