Does passportjs LocalStrategy allow more parameters than the default username and password?
There is there is the passReqToCallback argument.
passport.use(new LocalStrategy(
{
usernameField: 'username',
passwordField: 'password',
passReqToCallback: true
},
function (req, username, password, done) {
{
fieldName: req.body.fieldName,
password: password,
username: username
}
}));
I suspect what you are trying to do is save additional information on your user when he signs up.
All your information is store in req.body
so you just need to save it in your callback:
passport.use(new LocalStrategy({
usernameField: 'your_form_username_or_email_fieldname',
passwordField: 'your_form_password_fieldname'
},
function(username, password, done) {
// ...
// set the user's credentials
newUser.username = req.body.username;
newUser.email = req.body.email;
newUser.password = newUser.generateHash(password);
// ....
}
));
There is no need to change the local strategy as it only needs 2 arguements (the email/username + the password)