Showing
1 changed file
with
4 additions
and
0 deletions
... | @@ -77,6 +77,10 @@ export class Connection { | ... | @@ -77,6 +77,10 @@ export class Connection { |
77 | private handleLogin( | 77 | private handleLogin( |
78 | message: ServerInboundMessage<"login"> | 78 | message: ServerInboundMessage<"login"> |
79 | ): ServerResponse<"login"> { | 79 | ): ServerResponse<"login"> { |
80 | + if (message.nickname.length > 12 || message.nickname.trim().length === 0) { | ||
81 | + return { ok: false }; | ||
82 | + } | ||
83 | + | ||
80 | this.user = new User(message.nickname, this); | 84 | this.user = new User(message.nickname, this); |
81 | // console.log(`User ${message.username} has logged in!`); | 85 | // console.log(`User ${message.username} has logged in!`); |
82 | 86 | ... | ... |
-
Please register or login to post a comment