From b32a0bcfadfb0e6a3a832b1e493c0404f2f47bf7 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Mon, 4 Apr 2016 15:16:16 +0200 Subject: [PATCH] Do not allow empty username on createOwner() --- src/user.js | 2 ++ 1 file changed, 2 insertions(+) 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));