Initialize global database tables

This commit is contained in:
calzoneman 2013-12-26 22:15:54 -05:00
parent aff737b3a1
commit c213dd1374
2 changed files with 6 additions and 2 deletions

View file

@ -22,6 +22,7 @@ module.exports.init = function (cfg) {
Logger.errlog.log("! DB connection failed"); Logger.errlog.log("! DB connection failed");
return; return;
} else { } else {
module.exports.initGlobalTables();
// Refresh global IP bans // Refresh global IP bans
module.exports.listGlobalBans(); module.exports.listGlobalBans();
} }
@ -76,6 +77,9 @@ module.exports.query = function (query, sub, callback) {
}); });
}; };
/**
* Dummy function to be used as a callback when none is provided
*/
function blackHole() { function blackHole() {
} }
@ -92,7 +96,7 @@ module.exports.initGlobalTables = function () {
query("CREATE TABLE IF NOT EXISTS `global_bans` (" + query("CREATE TABLE IF NOT EXISTS `global_bans` (" +
"`ip` VARCHAR(39) NOT NULL," + "`ip` VARCHAR(39) NOT NULL," +
"`reason` VARCHAR(255) NOT NULL," + "`reason` VARCHAR(255) NOT NULL," +
"PRIMARY KEY (`ip`, `name`)) " + "PRIMARY KEY (`ip`)) " +
"CHARACTER SET utf8", "CHARACTER SET utf8",
fail("global_bans")); fail("global_bans"));

View file

@ -134,7 +134,7 @@ function handleRegister(req, res) {
password = password.substring(0, 100); password = password.substring(0, 100);
if (!$util.isValidEmail(email)) { if (email.length > 0 && !$util.isValidEmail(email)) {
sendJade(res, 'register', { sendJade(res, 'register', {
registerError: 'Invalid email address' registerError: 'Invalid email address'
}); });