diff options
author | marzavec <admin@marzavec.com> | 2018-07-30 02:29:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-30 02:29:13 +0200 |
commit | c06681803baab1d25c26e3bafec321d857386451 (patch) | |
tree | 53f8edd6153e751c6c9c95bb9fc48eba2c1fa133 | |
parent | Merge pull request #18 from OpSimple/master (diff) | |
parent | Check if the nickname is valid before adding a CSS class (diff) | |
download | hackchat-c06681803baab1d25c26e3bafec321d857386451.tar.gz hackchat-c06681803baab1d25c26e3bafec321d857386451.zip |
Merge pull request #28 from henrywright/27
Check if the nickname is valid before adding a CSS class
-rw-r--r-- | client/client.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/client/client.js b/client/client.js index 3adcd0e..1d72c9a 100644 --- a/client/client.js +++ b/client/client.js @@ -1,3 +1,4 @@ +const verifyNickname = (nick) => /^[a-zA-Z0-9_]{1,24}$/.test(nick); var frontpage = [ " _ _ _ _ ", " | |_ ___ ___| |_ ___| |_ ___| |_ ", @@ -157,7 +158,7 @@ function pushMessage(args) { var messageEl = document.createElement('div'); messageEl.classList.add('message'); - if (args.nick == myNick) { + if (verifyNickname(myNick) && args.nick == myNick) { messageEl.classList.add('me'); } else if (args.nick == '!') { messageEl.classList.add('warn'); |