From 78790eacec298ed5d63296b4393117de44034321 Mon Sep 17 00:00:00 2001 From: Dan Seripap Date: Thu, 25 Feb 2016 11:15:26 -0500 Subject: [PATCH] Parsing new usernames as string, requiring letter as starting name --- src/js/chat.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/chat.js b/src/js/chat.js index c9b6e9c..7d1e7f7 100644 --- a/src/js/chat.js +++ b/src/js/chat.js @@ -162,15 +162,15 @@ export default class Chat { action: () => { let newUsername = trigger.params[0] || false; - if (newUsername > 16) { + if (newUsername.toString().length > 16) { return this.log('Username cannot be greater than 16 characters.', {error: true}); } // Remove things that arent digits or chars newUsername = newUsername.replace(/[^A-Za-z0-9]/g, '-'); - if (!newUsername.match(/^[A-Z0-9]/i)) { - return this.log('Username must start with a letter or number.', {error: true}); + if (!newUsername.match(/^[A-Z]/i)) { + return this.log('Username must start with a letter.', {error: true}); } this.darkwire.updateUsername(window.username, newUsername).then((socketData) => {