daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest May 27th, 2018 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.post('/register', function (req, res, next) {
  2.     console.log('4');
  3.     if (req.body.user.email &&
  4.         req.body.user.username &&
  5.         req.body.user.password &&
  6.         req.body.user.passwordConf) {
  7.         console.log('1');
  8.  
  9.         var userData = {
  10.             email: req.body.user.email,
  11.             username: req.body.user.username,
  12.             password: req.body.user.password,
  13.             passwordConf: req.body.user.passwordConf,
  14.         }
  15.         console.log('2');
  16.         console.log(userData);
  17.  
  18.         User.create(userData, function (error, user) {
  19.             if (error) {
  20.                 return next(error);
  21.             } else {
  22.                 req.session.userId = user._id;
  23.                 console.log('3');
  24.                 return res.redirect('/main');
  25.  
  26.             }
  27.             console.log('7');
  28.         });
  29.         console.log('8');
  30.     }
  31. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top