diff --git a/users.js b/users.js index 8e8f2dfab66e..3c57b6548391 100644 --- a/users.js +++ b/users.js @@ -721,7 +721,9 @@ class User { * @param {Connection} connection The connection asking for the rename */ async rename(name, token, newlyRegistered, connection) { + let userid = toId(name); for (const roomid of this.games) { + if (userid === this.userid) break; const game = Rooms(roomid).game; if (!game || game.ended) continue; // should never happen if (game.allowRenames || !this.named) continue; @@ -747,7 +749,6 @@ class User { return false; } - let userid = toId(name); if (userid.length > 18) { this.send(`|nametaken||Your name must be 18 characters or shorter.`); return false;