text: 'use strict';
  
  var validator = require('validator'),
    path = require('path'),
    config = require(path.resolve('./config/config'));
    
  
  /**
   * Render the main application page
   */
  exports.renderIndex = function (req, res) {
    var safeUserObject = null;
    if (req.user) {
      safeUserObject = {
        displayName: validator.escape(req.user.displayName),
        provider: validator.escape(req.user.provider),
        username: validator.escape(req.user.username),
        created: req.user.created.toString(),
        roles: req.user.roles,
        profileImageURL: req.user.profileImageURL,
        email: validator.escape(req.user.email),
        lastName: validator.escape(req.user.lastName),
        firstName: validator.escape(req.user.firstName),
        fonction: req.user.fonction,
        etablissement:req.user.etablissement,
        adresse: req.user.adresse,
        cp:req.user.cp,
        cv:req.user.cv,
        ville: req.user.ville,
        tel: req.user.tel,
        civilite: req.user.civilite,
        matricule: req.user.matricule,
        dn: req.user.dn,
        additionalProvidersData: req.user.additionalProvidersData
      };
    }
  
    res.render('modules/core/server/views/index', {
      user: JSON.stringify(safeUserObject),
      sharedConfig: JSON.stringify(config.shared)
    });
  };
  
  /**
   * Render the server error page
   */
  exports.renderServerError = function (req, res) {
    res.status(500).render('modules/core/server/views/500', {
      error: 'Oops! Something went wrong...'
    });
  };
  
  
  
  
  
  // exports.getVicopo = function(req, res){
  //   var ville = req.body.val;
  //   console.log(req.body);
    
  //   res.vicopo(ville, function (err, cities) {
  //     if (err) {
  //         throw err;
  //     } else {
  //         res.json(cities);
  //         console.log(cities);
  //     }
  // });
    
  // };
  
  /**
   * Render the server not found responses
   * Performs content-negotiation on the Accept HTTP header
   */
  exports.renderNotFound = function (req, res) {
  
    res.status(404).format({
      'text/html': function () {
        res.render('modules/core/server/views/404', {
          url: req.originalUrl
        });
      },
      'application/json': function () {
        res.json({
          error: 'Path not found'
        });
      },
      'default': function () {
        res.send('Path not found');
      }
    });
  };
  