I am trying to set up a website that will allow me to take a user's current session and add database items to their entry. Instead what it's doing is creating an entire new entry in the database instead of adding to the user that is logged in.
The create function in the editprofile post is probably not right but I do not know what to substitute it for
var UserSchema = new mongoose.Schema({
username: String,
password: String,
salt: String,
hash: String,
Industry: String,
CompanyName: String
});
app.configure(function () {
app.use(express.bodyParser());
app.use(express.cookieParser('Company Profiler'));
app.use(express.session());
});
app.use(function (req, res, next) {
res.locals.session = req.session;
next();
});
app.post("/signup", userExist, function (req, res) {
console.log(req.body);
var password = req.body.password;
var username = req.body.username;
hash(password, function (err, salt, hash) {
if (err) throw err;
var user = new User({
username: username,
salt: salt,
hash: hash,
});
});
});
app.post("/editprofile", function (req, res){
var Industry = req.body.industry;
var CompanyName = req.body.industry;
User.create({
Industry: Industry;
CompanyName: CompanyName;
});
});