diff options
author | tomsmeding <hallo@tomsmeding.nl> | 2015-04-21 21:34:45 +0200 |
---|---|---|
committer | tomsmeding <hallo@tomsmeding.nl> | 2015-04-21 21:34:45 +0200 |
commit | e09476ef487f2d6f74bb1d56f63462b5d2daf672 (patch) | |
tree | 19fc81182abd3977848e07800888dbe4e11e8576 | |
parent | 9be3ecd4eeb4e0481bb9ce2ee0ca5a5b2d754342 (diff) |
Add nickname length restriction
-rwxr-xr-x | chatserver.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/chatserver.js b/chatserver.js index 0529630..00ca0f1 100755 --- a/chatserver.js +++ b/chatserver.js @@ -58,7 +58,7 @@ new WebSocketServer({port:WSPORT}).on("connection",function(ws){ } else if(msg.match(/^#nick /)){ var choice=msg.slice(6).replace(/[\x00-\x20\x7F\x80-\xFF]/g,""); //all shitty characters including space (' ') var i; - if(choice.length==0){ + if(choice.length==0||choice.length>8){ ws.send("#error Invalid nick"); return; } |