allow only alpha numerals in username

This commit is contained in:
Girish Ramakrishnan
2016-05-25 21:36:20 -07:00
parent a28560cdc0
commit b3f53099f0

View File

@@ -88,6 +88,9 @@ function validateUsername(username) {
if (RESERVED_USERNAMES.indexOf(username) !== -1) return new UserError(UserError.BAD_USERNAME, 'Username is reserved');
// +/- can be tricky in emails
if (/[^a-zA-Z0-9.]/.test(username)) return new UserError(UserError.BAD_USERNAME, 'Username can only contain alphanumerals and dot');
if (username.indexOf('-app') !== -1) return new UserError(UserError.BAD_USERNAME, 'Username pattern is reserved for apps');
return null;