From 4552e6286e11c0927ceb9843a22becb4fa0a472d Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Thu, 7 Nov 2013 12:17:23 -0500 Subject: [PATCH] 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) {