title: Prevent User from logging again in passportjs if they are authenticated once?
body: <p>I am using PassportJS, and signup and login functions are working quite smooth.</p>
  
  <p>The only problem I am facing with PassportJS (I am using sessions too), that even when the user had logged in, they can again go back to the signup/login url and do signup and/or login back!</p>
  
  <p>This is tempting me. If anyone has a fix/suggestion, please put it down.</p>
  
  <p><strong>UPDATE - 1</strong></p>
  
  <p>Glimpse of my<code>routes.js</code>: (Using PassportJS along with connet-ensure-login.</p>
  
  <pre><code>app.get('*', function(req, res, next) {
      if (req.url.indexOf('/users/login') &lt; 0 &amp;&amp;
          req.url.indexOf('/users/signup') &lt; 0) {
          req.session.returnTo = null;
      }
      next();
  });
  
  // =====================================
  // HOME PAGE (with login links) ========
  // =====================================
  app.get('/', sabSettings, function(req, res) {
      Setting.findOne(function(err, setting) {
          if (err)
              throw err;
          // console.log(setting);
          res.render('index', { title: 'eduBird | Reach the glory', setting: req.setting }); // load the index file
      });
  });
  
  // =====================================
  // LOGIN ===============================
  // =====================================
  // show the login form
  app.get('/login', sabSettings, function(req, res) {
  
      // render the page and pass in any flash data if it exists
      res.render('login', {
          message: req.flash('loginMessage'),
          errors: req.flash('error'),
          title: 'Login | eduBird',
          setting: req.setting
      });
  });
  
  // process the login form
  
  app.post('/login', passport.authenticate('local-login', {
      successReturnToOrRedirect: '/loggedin',
      failureRedirect: '/login',
      failureFlash: true
  }));
  
  // =====================================
  // SIGNUP ==============================
  // =====================================
  // show the signup form
  app.get('/signup', sabSettings, function(req, res) {
  
      // render the page and pass in any flash data if it exists
      process.nextTick(function() {
          res.render('signup', {
              message: req.flash('signupMessage'),
              errors: req.flash('error'),
              title: 'Register | eduBird',
              setting: req.setting
          });
      });
  });
  
  // process the signup form
  app.post('/signup', passport.authenticate('local-signup', {
      successReturnToOrRedirect: '/profile/welcome',
      failureRedirect: '/signup',
      failureFlash: true
  }));
  </code></pre>