-1
const bodyParser = require('body-parser');
const bcrypt = require('bcryptjs');
//Bring in User Model
let User = require('../models/user');
var urlencodedParser = bodyParser.urlencoded({extended: false});
module.exports = function(app){
app.get('/signup', function(req, res){
res.render('signup');
});
app.post('/signup', urlencodedParser, function(req, res){
const fstName = req.body.userName;
const sncName = req.body.userLastName;
const email = req.body.userEmail;
const pass = req.body.userPassword;
const rePass = req.body.userRePassword;
const birDay = req.body.userBirDay;
const birMonth = req.body.userBirMonth;
const birYear = req.body.userBirYear;
const gender = req.body.userGender;
const birthday = birYear + '-' + birMonth + '-' + birDay;
let newUser = new User({
firstName: fstName,
lastName: sncName,
email: email,
password: pass,
birthday: birthday,
gender:gender
});
bcrypt.getSalt(10, function(err, salt){
bcrypt.hash(newUser.password, salt, function(err, salt){
newUser.password = hash;
newUser.save().then(function(){
res.render('signup');
});
});
});
});
};
This is returning this error: Illegal Arguments: number
Vlwwww man!!!!!! gave it just right
– Vinnicius Pereira