Bad Request when registering with passport
问题 I am trying to build an authentication panel for the MEAN stack using PassportJS. I have the following code for registering new users with email (instead of the default username) and password: router.post("/register", function (req, res) { var newUser = new User({ username: req.body.email }); User.register(newUser, req.body.password, function (err, user) { if (err) { return res.render('account/signup'); } passport.authenticate("local")(req, res, function () { res.redirect("/account/profile");