diff options
author | John McLear <john@mclear.co.uk> | 2015-11-26 15:55:26 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2015-11-26 15:55:26 +0000 |
commit | 8a79ae6e0229075dcc4d153463e5e27233746b97 (patch) | |
tree | 13c747dcd161bc980f81766f42893576234462c7 /src/node/handler/PadMessageHandler.js | |
parent | a913f5799493ba79894e84126f9d9e735b7a5c0e (diff) | |
download | etherpad-lite-8a79ae6e0229075dcc4d153463e5e27233746b97.zip |
regex incoming colors
Diffstat (limited to 'src/node/handler/PadMessageHandler.js')
-rw-r--r-- | src/node/handler/PadMessageHandler.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 9481889f..bf8737fc 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -566,6 +566,13 @@ function handleUserInfoUpdate(client, message) //Find out the author name of this session var author = session.author; + // Check colorId is a Hex color + var isColor = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(message.data.userInfo.colorId) // for #f00 (Thanks Smamatti) + if(!isColor){ + messageLogger.warn("Dropped message, USERINFO_UPDATE Color is malformed." + message.data); + return; + } + //Tell the authorManager about the new attributes authorManager.setAuthorColorId(author, message.data.userInfo.colorId); authorManager.setAuthorName(author, message.data.userInfo.name); |