I am working on node + passport.js authentication. I am making a simple login / registration application. It works fine, but it only stores username and password.
How can I store other form fields, such as phone number, email address, hobby, gender in the database through the signup.html login authentication page? Anyone has a solution for this, so I can store all the fields in the database ....
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var userSchema = mongoose.Schema({
local : {
username : String,
gender : String,
phone : String,
email : String,
password : String
}
});
userSchema.methods.generateHash = function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};
userSchema.methods.validPassword = function(password) {
return bcrypt.compareSync(password, this.local.password);
};
var User = mongoose.model('user', userSchema);
module.exports = User;
In this code, I use the email scheme, username, password, gender phone, and also the field data on the signup.html page. but it only saves username and password fields only .........