Do not allow empty username on createOwner()

This commit is contained in:
Johannes Zellner
2016-04-04 15:16:16 +02:00
parent 61c79aab23
commit b32a0bcfad

View File

@@ -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));