From de6db0285c0ff9c1a73c84fca4cbd877ccfc17e5 Mon Sep 17 00:00:00 2001 From: Yann Flory Date: Wed, 16 Mar 2016 17:48:27 +0100 Subject: [PATCH] Limit the size of the usernames to 32 chars --- www/pad/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/www/pad/main.js b/www/pad/main.js index 68682ef68..3c8787ea8 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -145,7 +145,11 @@ define([ buttonElmt.addEventListener("click", function() { var newName = prompt("Change your name :", myUserName) if (newName && newName.trim()) { - myUserName = newName.trim(); + var myUserNameTemp = newName.trim(); + if(newName.trim().length > 32) { + myUserNameTemp = myUserNameTemp.substr(0, 31); + } + myUserName = myUserNameTemp; myData[myID] = { name: myUserName };