don't use regex on existing lists

This commit is contained in:
Riley Davis
2017-01-09 15:41:47 -07:00
parent 7bc848b801
commit b6eaf210fe
2 changed files with 2 additions and 4 deletions
-2
View File
@@ -342,7 +342,6 @@ const isValidDisplayName = (displayName) => {
UserService.createLocalUser = (email, password, displayName) => {
if (!email) {
return Promise.reject(errors.ErrMissingEmail);
}
@@ -350,7 +349,6 @@ UserService.createLocalUser = (email, password, displayName) => {
displayName = displayName.toLowerCase().trim();
if (!password) {
return Promise.reject(errors.ErrMissingPassword);
}
+2 -2
View File
@@ -176,8 +176,8 @@ class Wordlist {
displayName = displayName.replace(/_/g, '');
// test each word, and fail if we find a match
const hasBadWords = wl.lists.banned.some(word => {
return new RegExp(word, 'ig').test(displayName);
const hasBadWords = wl.lists.banned.some(phrase => {
return displayName.indexOf(phrase.join('')) !== -1;
});
if (hasBadWords) {