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");
return;
} else {
module.exports.initGlobalTables();
// Refresh global IP bans
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() {
}
@ -92,7 +96,7 @@ module.exports.initGlobalTables = function () {
query("CREATE TABLE IF NOT EXISTS `global_bans` (" +
"`ip` VARCHAR(39) NOT NULL," +
"`reason` VARCHAR(255) NOT NULL," +
"PRIMARY KEY (`ip`, `name`)) " +
"PRIMARY KEY (`ip`)) " +
"CHARACTER SET utf8",
fail("global_bans"));

View File

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