mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-05-06 04:36:17 +02:00
regex incoming colors
This commit is contained in:
parent
a913f57994
commit
8a79ae6e02
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user