Do not allow empty username on createOwner()
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user