Привет, не могли бы вы объяснить эту поправку, пожалуйста, я не уверен, что это будет делать, когда моя стратегия называется

ользую паспортаlocal-signup и может создать пользователя через форму и успешно перенаправить страницу на указанную мной страницу.

Моя проблема на данный момент заключается в том, что при перенаправлении страница просто зависает. Я вижу, что есть другие, которые испытывали подобное, но, глядя на то, что у меня есть, я не могу понять, почему мой пример висит.

Сначала я провожу простую проверку формы, и если все в порядке, я продолжаю настройку паспорта:

app.post('/signup', function(req, res, next) {
  // Capture form details for when validation fails so can repopulate
  var form = {
    first_name: req.body.first_name,
    last_name: req.body.last_name,
    email:  req.body.email
  }

  var first_name = req.body.first_name;
  var last_name = req.body.last_name;
  var email = req.body.email;
  var password = req.body.password;
  var password_confirmation = req.body.password_confirmation;

  // Validation
  req.checkBody('first_name', 'First Name is required').notEmpty();
  req.checkBody('last_name', 'Last Name is required').notEmpty();
  req.checkBody('email', 'Email is required').notEmpty();
  req.checkBody('email', 'Email is not valid').isEmail();
  req.checkBody('password', 'Password is required').notEmpty();
  req.checkBody('password_confirmation', 'Passwords do not match').equals(req.body.password);

  var errors = req.validationErrors();

  if (errors) {
    res.render('home', {
      errors: errors,
      form: form
    });
  }
  else {
    passport.authenticate('local-signup', {
      successRedirect : '/members', // redirect to the secure profile section
      failureRedirect : '/', // redirect back to the signup page if there is an error
      failureFlash : true // allow flash messages
    })(req, res, next);

  }
});

local-signup

passport.use('local-signup', new LocalStrategy({
        // by default, local strategy uses username and password, we will override with email
        usernameField : 'email',
        passwordField : 'password',
        passReqToCallback : true // allows us to pass back the entire request to the callback
    },
    function(req, email, password, done) {
      // asynchronous
      // User.findOne won't fire unless data is sent back
      process.nextTick(function(callback) {
        // we are checking to see if the user trying to sign up already exists
        // User.findOne declared in User Model
        User.findOne(email, function(err, isNotAvailable, user) {
          if (err) return done(err);

          // check to see if theres already a user with that email
          if (isNotAvailable == true) {
            return done(null, false, { message: 'That email is already taken.' });
          } else {

            newUser = new Object();
            newUser.email = email;
            newUser.password = bcrypt.hashSync(password, 10);

            pool.query('INSERT INTO users(email, password) VALUES($1, $2) RETURNING *', [newUser.email, newUser.password], function (err, result) {
            if(err){
              console.log(err);
              return console.error('error running query', err);
            }
              newUser.id = result.rows[0].id;
              return done(null, newUser);
            });
          } // isNotAvailable
        }); //User.findOne
      });
    }));

Ответы на вопрос(1)

Ваш ответ на вопрос