restrict group names

This commit is contained in:
girish@cloudron.io
2016-02-08 09:41:21 -08:00
parent e39d7750c5
commit b1935c3550
2 changed files with 9 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ function validateGroupname(name) {
if (name.length <= 2) return new GroupError(GroupError.BAD_NAME, 'name must be atleast 3 chars');
if (name.length >= 200) return new GroupError(GroupError.BAD_NAME, 'name too long');
if (!/^[A-Za-z0-9_-]*$/.test(name)) return new GroupError(GroupError.BAD_NAME, 'name can only have A-Za-z0-9_-');
return null;
}