Add contact page

This commit is contained in:
calzoneman 2014-02-13 18:15:22 -06:00
parent d24214949a
commit 1cbb1c2a6a
7 changed files with 95 additions and 7 deletions

View file

@ -177,9 +177,6 @@ function handleSocketConfig(req, res) {
"IO_URL=WEB_URL=SSL_URL;}" : ""));
}
/**
* Handles a request for the user agreement
*/
function handleUserAgreement(req, res) {
logRequest(req);
sendJade(res, "tos", {
@ -187,6 +184,36 @@ function handleUserAgreement(req, res) {
});
}
function handleContactPage(req, res) {
logRequest(req);
// Make a copy to prevent messing with the original
var contacts = Config.get("contacts").map(function (c) {
return {
name: c.name,
email: c.email,
title: c.title
};
});
// Rudimentary hiding of email addresses to prevent spambots
contacts.forEach(function (c) {
c.emkey = $util.randomSalt(16)
var email = new Array(c.email.length);
for (var i = 0; i < c.email.length; i++) {
email[i] = String.fromCharCode(
c.email.charCodeAt(i) ^ c.emkey.charCodeAt(i % c.emkey.length)
);
}
c.email = escape(email.join(""));
c.emkey = escape(c.emkey);
});
sendJade(res, "contact", {
contacts: contacts
});
}
module.exports = {
/**
* Initializes webserver callbacks
@ -210,6 +237,7 @@ module.exports = {
app.get("/", handleIndex);
app.get("/sioconfig", handleSocketConfig);
app.get("/useragreement", handleUserAgreement);
app.get("/contact", handleContactPage);
require("./auth").init(app);
require("./account").init(app);
require("./acp").init(app);