<commit_before>var express = require('express');
var router = express.Router();
var auth = require('../controllers/authorization');
var restler = require('restler');

/* GET home page. */
router.get('/', auth.requiresLogin,  function(req, res, next) {
  try{
    restler.get(
      process.env.LDCVIA_IDEAS_APIHOST + "/collections/ldcvia-ideas/ideas",
      {headers:
        {'apikey': req.cookies.apikey}
      }
    )
    .on('complete', function(data, response){
      res.render('index', {"tab":"home", "email": req.cookies.email, "ideas": data});
    });
  }catch(e){
    res.render("login", {"error": e});
  }
});

router.get('/about', function(req, res, next) {
  try{
    restler.get(
      process.env.LDCVIA_IDEAS_APIHOST + "/document/ldcvia-ideas/staticpages/about",
      {headers:
        {'apikey': process.env.LDCVIA_IDEAS_ADMINAPIKEY}
      }
    )
    .on('complete', function(data, response){
      res.render('static', {"tab":"about", "page": data});
    });
  }catch(e){
    res.render("login", {"error": e});
  }
});

router.get('/contact', function(req, res, next) {
  try{
    restler.get(
      process.env.LDCVIA_IDEAS_APIHOST + "/document/ldcvia-ideas/staticpages/contact",
      {headers:
        {'apikey': process.env.LDCVIA_IDEAS_ADMINAPIKEY}
      }
    )
    .on('complete', function(data, response){
      res.render('static', {"tab":"contact", "page": data});
    });
  }catch(e){
    res.render("login", {"error": e});
  }
});

/* GET login page */
router.get('/login',  function(req, res, next) {
  res.render('login', {"tab": "home"});
});

router.post('/login', function(req, res, next){<commit_msg>Fix logout display on static pages<commit_after>var express = require('express');
var router = express.Router();
var auth = require('../controllers/authorization');
var restler = require('restler');

/* GET home page. */
router.get('/', auth.requiresLogin,  function(req, res, next) {
  try{
    restler.get(
      process.env.LDCVIA_IDEAS_APIHOST + "/collections/ldcvia-ideas/ideas",
      {headers:
        {'apikey': req.cookies.apikey}
      }
    )
    .on('complete', function(data, response){
      res.render('index', {"tab":"home", "email": req.cookies.email, "ideas": data});
    });
  }catch(e){
    res.render("login", {"error": e});
  }
});

router.get('/about', function(req, res, next) {
  try{
    restler.get(
      process.env.LDCVIA_IDEAS_APIHOST + "/document/ldcvia-ideas/staticpages/about",
      {headers:
        {'apikey': process.env.LDCVIA_IDEAS_ADMINAPIKEY}
      }
    )
    .on('complete', function(data, response){
      res.render('static', {"tab":"about", "email": req.cookies.email, "page": data});
    });
  }catch(e){
    res.render("login", {"error": e});
  }
});

router.get('/contact', function(req, res, next) {
  try{
    restler.get(
      process.env.LDCVIA_IDEAS_APIHOST + "/document/ldcvia-ideas/staticpages/contact",
      {headers:
        {'apikey': process.env.LDCVIA_IDEAS_ADMINAPIKEY}
      }
    )
    .on('complete', function(data, response){
      res.render('static', {"tab":"contact", "email": req.cookies.email, "page": data});
    });
  }catch(e){
    res.render("login", {"error": e});
  }
});

/* GET login page */
router.get('/login',  function(req, res, next) {
  res.render('login', {"tab": "home"});
});

router.post('/login', function(req, res, next){
{'fraction_non_alphanumeric': 0.20817178645988668, 'fraction_numerical': 0.0, 'mean_word_length': 3.413157894736842, 'pattern_counts': {'":': 24, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3658987', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1164, 'n_words': 204}