From: Darren Date: Sat, 9 Mar 2013 14:48:13 +0000 (+0000) Subject: Client: Don't connect if no nick chosen X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=848e2dca9228ca2430d42fee95c0e93d79e8f2b2;p=KiwiIRC.git Client: Don't connect if no nick chosen --- diff --git a/client/assets/dev/view.js b/client/assets/dev/view.js index 0e20aec..41bde15 100644 --- a/client/assets/dev/view.js +++ b/client/assets/dev/view.js @@ -150,6 +150,15 @@ _kiwi.view.ServerSelect = function () { }, submitForm: function (event) { + event.preventDefault(); + + // Make sure a nick is chosen + if (!$('input.nick', this.$el).val().trim()) { + this.setStatus('Select a nickname first!'); + $('input.nick', this.$el).select(); + return; + } + if (state === 'nick_change') { this.submitNickChange(event); } else { @@ -157,7 +166,7 @@ _kiwi.view.ServerSelect = function () { } $('button', this.$el).attr('disabled', 1); - return false; + return; }, submitLogin: function (event) { @@ -245,7 +254,7 @@ _kiwi.view.ServerSelect = function () { $('.status', this.$el) .text(text) .attr('class', 'status') - .addClass(class_name) + .addClass(class_name||'') .show(); }, clearStatus: function () {