From 4552e6286e11c0927ceb9843a22becb4fa0a472d Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Thu, 7 Nov 2013 12:17:23 -0500 Subject: [PATCH 1/4] dont allow empty userslugs to register --- public/src/forum/register.js | 2 +- src/user.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/src/forum/register.js b/public/src/forum/register.js index fc7cf26b2a..6270f0c14c 100644 --- a/public/src/forum/register.js +++ b/public/src/forum/register.js @@ -61,7 +61,7 @@ define(function() { showError(username_notify, 'Username too short!'); } else if (username.val().length > config.maximumUsernameLength) { showError(username_notify, 'Username too long!'); - } else if (!utils.isUserNameValid(username.val())) { + } else if (!utils.isUserNameValid(username.val()) || !utils.slugify(username.val())) { showError(username_notify, 'Invalid username!'); } else { socket.emit('user.exists', { diff --git a/src/user.js b/src/user.js index 1763b6c862..c40e17fa6d 100644 --- a/src/user.js +++ b/src/user.js @@ -31,7 +31,7 @@ var utils = require('./../public/src/utils.js'), } }, function(next) { - next(!utils.isUserNameValid(username) ? new Error('Invalid Username!') : null); + next((!utils.isUserNameValid(username) || !userslug) ? new Error('Invalid Username!') : null); }, function(next) { if (password !== undefined) { From aa1994be671fc4141ed51f6dd742aff9231f10e7 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 7 Nov 2013 15:52:17 -0500 Subject: [PATCH 2/4] updated MOTD to not be inside a jumbotron, updated default styling of MOTD --- public/templates/home.tpl | 2 +- src/routes/api.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/templates/home.tpl b/public/templates/home.tpl index 48032a83b3..cc8c5073fa 100644 --- a/public/templates/home.tpl +++ b/public/templates/home.tpl @@ -1,4 +1,4 @@ -
+
{motd}
diff --git a/src/routes/api.js b/src/routes/api.js index b3c9afde81..f52b43d273 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -51,8 +51,10 @@ var user = require('./../user.js'), } async.each(data.categories, iterator, function (err) { - data.motd_class = (meta.config.show_motd === '1' || meta.config.show_motd === undefined) ? '' : 'none'; - data.motd = require('marked')(meta.config.motd || "# NodeBB v " + pkg.version + "\nWelcome to NodeBB, the discussion platform of the future.\n\n"); + data.motd_class = (meta.config.show_motd === '1' || meta.config.show_motd === undefined) ? '' : ' none'; + data.motd_class += (meta.config.motd.length > 0 ? '' : ' default'); + + data.motd = require('marked')(meta.config.motd || "\n\n# NodeBB v" + pkg.version + "\nWelcome to NodeBB, the discussion platform of the future."); res.json(data); }); From 885eec79c303176436ec7b976fb90512965929c5 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 7 Nov 2013 15:54:19 -0500 Subject: [PATCH 3/4] ninjafix for bad conditional --- src/routes/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/api.js b/src/routes/api.js index f52b43d273..5b4e1c5f10 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -52,7 +52,7 @@ var user = require('./../user.js'), async.each(data.categories, iterator, function (err) { data.motd_class = (meta.config.show_motd === '1' || meta.config.show_motd === undefined) ? '' : ' none'; - data.motd_class += (meta.config.motd.length > 0 ? '' : ' default'); + data.motd_class += (meta.config.motd && meta.config.motd.length > 0 ? '' : ' default'); data.motd = require('marked')(meta.config.motd || "\n\n# NodeBB v" + pkg.version + "\nWelcome to NodeBB, the discussion platform of the future."); res.json(data); From 1f2ef2a7e414a85d72c85c826fe583d59cf7095a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 7 Nov 2013 15:59:07 -0500 Subject: [PATCH 4/4] updated cerulean minver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b59f9c96bd..97bc6f2283 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "nodebb-plugin-mentions": "~0.1.14", "nodebb-plugin-markdown": "~0.1.8", "nodebb-theme-vanilla": "designcreateplay/nodebb-theme-vanilla", - "nodebb-theme-cerulean": "0.0.5", + "nodebb-theme-cerulean": "0.0.6", "cron": "~1.0.1" }, "optionalDependencies": {