diff --git a/src/user.js b/src/user.js index 4a0d121b7..947a0fc80 100644 --- a/src/user.js +++ b/src/user.js @@ -412,6 +412,8 @@ function createOwner(username, password, email, displayName, callback) { assert.strictEqual(typeof displayName, 'string'); assert.strictEqual(typeof callback, 'function'); + if (username === '') return new UserError(UserError.BAD_USERNAME, 'Username cannot be empty'); + userdb.count(function (error, count) { if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error)); if (count !== 0) return callback(new UserError(UserError.ALREADY_EXISTS));