routes/login.js
function(req, res) {
      var url = passport.config.loginRedirect || '/profile';
      var statusCode = 302; //303 is more accurate but express redirect() defaults
      //to 302 so stick to that for consistency
      if (req.session && req.session.returnTo) {
        if (req.session.returnToMethod == req.method) {
          statusCode = 307;
        }
        if (req.query.h && req.session.returnTo.indexOf('#') == -1) {
          url = req.session.returnTo + '#' + req.query.h;
        } else {
          url = req.session.returnTo;
        }
        delete req.session.returnTo;
      }
      return res.redirect(statusCode, url);
    }
function(req, res) {
      var url = passport.config.loginRedirect || '/profile';
      var statusCode = 302; //303 is more accurate but express redirect() defaults
      //to 302 so stick to that for consistency
      if (req.session && req.session.returnTo) {
        if (req.session.returnToMethod == req.method) {
          statusCode = 307;
        }
        if (req.query.h && req.session.returnTo.indexOf('#') == -1) {
          url = req.session.returnTo + '#' + req.query.h;
        } else {
          url = req.session.returnTo;
        }
        delete req.session.returnTo;
      }
      return res.redirect(statusCode, url);
    }
function ( req , res ) { var url = passport . config . loginRedirect || '/profile' ; var statusCode = 302 ; //303 is more accurate but express redirect() defaults //to 302 so stick to that for consistency if ( req . session && req . session . returnTo ) { if ( req . session . returnToMethod == req . method ) { statusCode = 307 ; } if ( req . query . h && req . session . returnTo . indexOf ( '#' ) == - 1 ) { url = req . session . returnTo + '#' + req . query . h ; } else { url = req . session . returnTo ; } delete req . session . returnTo ; } return res . redirect ( statusCode , url ) ; }
replace passport's successReturnToOrRedirect option with one that preserves the http method so that we can return to a redirected POST.
replace passport s successReturnToOrRedirect option with one that preserves the http method so that we can return to a redirected POST .