diff --git a/src/groups.js b/src/groups.js index 046ff6789..8bea55dd8 100644 --- a/src/groups.js +++ b/src/groups.js @@ -64,11 +64,8 @@ function validateGroupname(name) { if (constants.RESERVED_NAMES.indexOf(name) !== -1) return new GroupsError(GroupsError.BAD_FIELD, 'name is reserved'); - // +/- can be tricky in emails. also need to consider valid LDAP characters here (e.g '+' is reserved) - if (/[^a-zA-Z0-9.]/.test(name)) return new GroupsError(GroupsError.BAD_FIELD, 'name can only contain alphanumerals and dot'); - - // app emails are sent using the .app suffix - if (name.indexOf('.app') !== -1) return new GroupsError(GroupsError.BAD_FIELD, 'name pattern is reserved for apps'); + // need to consider valid LDAP characters here (e.g '+' is reserved) + if (/[^a-zA-Z0-9.-]/.test(name)) return new GroupsError(GroupsError.BAD_FIELD, 'name can only contain alphanumerals, hyphen and dot'); return null; } diff --git a/src/test/groups-test.js b/src/test/groups-test.js index 1735e9ea6..0eceb8dd3 100644 --- a/src/test/groups-test.js +++ b/src/test/groups-test.js @@ -108,7 +108,7 @@ describe('Groups', function () { }); it('cannot create group - invalid', function (done) { - groups.create('cloudron-admin', function (error) { + groups.create('cloudron+admin', function (error) { expect(error.reason).to.be(GroupsError.BAD_FIELD); done(); }); @@ -124,7 +124,7 @@ describe('Groups', function () { it('cannot create existing group with mixed case', function (done) { var name = GROUP0_NAME[0].toUpperCase() + GROUP0_NAME.substr(1); - groups.create(name, function (error, result) { + groups.create(name, function (error) { expect(error.reason).to.be(GroupsError.ALREADY_EXISTS); done(); });