Here the code is
passport.use('local-signup', new LocalStrategy({
usernameField : 'email',
passwordField : 'password',
passReqToCallback : true
},
function(req, email, password, done) {
console.log("email==" + email + " " + "password==" + password);
User.findOne({ 'email' : email }, function(err, user) {
if (err)
return done(err);
if (user) {
return done(null, false, req.flash('signupMessage', 'That email is already taken.'));
} else {
var newUser = new User();
newUser.email = email;
newUser.password = newUser.generateHash(password);
newUser.save(function(err) {
if (err)
throw err;
return done(null, newUser);
});
}
});
}));
My question is
Can We changed value of usernameField and passwordField?
As usernameField and passwordField keys never be changed because it is predifned keys in passport library.
passport.use('local-signup', new LocalStrategy({
usernameField : 'emailId',
passwordField : 'paswrd',
passReqToCallback : true
},
via Rahul Saini
No comments:
Post a Comment