diff --git a/client/views/windows/connect.tpl b/client/views/windows/connect.tpl index e50ebb5d..628c1764 100644 --- a/client/views/windows/connect.tpl +++ b/client/views/windows/connect.tpl @@ -29,13 +29,13 @@
- +
- +
@@ -65,28 +65,28 @@
- +
{{#unless useHexIp}}
- +
{{/unless}}
- + {{> ../reveal-password}}
- +
{{#if defaults.uuid}}
diff --git a/src/models/network.js b/src/models/network.js index 0bf59524..28edc340 100644 --- a/src/models/network.js +++ b/src/models/network.js @@ -64,6 +64,11 @@ function Network(attr) { } Network.prototype.validate = function(client) { + // If entered nick is over 100 characters, limit it so we don't try to compile a big regex + if (this.nick && this.nick.length > 100) { + this.nick = this.nick.substring(0, 100); + } + this.setNick(String(this.nick || Helper.getDefaultNick()).replace(" ", "_")); if (!this.username) { diff --git a/src/plugins/inputs/nick.js b/src/plugins/inputs/nick.js index a0a486ed..ecff77ae 100644 --- a/src/plugins/inputs/nick.js +++ b/src/plugins/inputs/nick.js @@ -24,6 +24,14 @@ exports.input = function(network, chan, cmd, args) { const newNick = args[0]; + if (newNick.length > 100) { + chan.pushMessage(this, new Msg({ + type: Msg.Type.ERROR, + text: "Nicknames may not be this long.", + })); + return; + } + // If connected to IRC, send to server and wait for ACK // otherwise update the nick and UI straight away if (network.irc && network.irc.connection) {