Profile should no longer work after logout

Tell us what’s happening:
Describe your issue in detail here.

This test only passes when I comment the line with, else console says that object is undefined.

glitch link: https://dm-passport.glitch.me

next(null, doc.ops[0]

Your code so far

  app.route("/register").post(
    (req, res, next) => {
      myDataBase.findOne({ username: req.body.username }, (err, user) => {
        if (err) {
          next(err);
        } else if (user) {
          res.redirect("/");
        } else {
          myDataBase.insertOne(
            {
              username: req.body.username,
              password: req.body.password
            }, (err, doc) => {
              if (err) {
                res.redirect("/");
              } else {
                // next(null, doc.ops[0]);
              }
            }
          );
        }
      });
    },
    passport.authenticate("local", { failureRedirect: "/" }), (req, res, next) => {
      res.redirect("/profile");
    }
  );

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.115 Safari/537.36

Challenge: Registration of New Users

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.