Client: Don't connect if no nick chosen
authorDarren <darren@Darrens-MacBook-Pro.local>
Sat, 9 Mar 2013 14:48:13 +0000 (14:48 +0000)
committerDarren <darren@Darrens-MacBook-Pro.local>
Sat, 9 Mar 2013 14:48:13 +0000 (14:48 +0000)
client/assets/dev/view.js

index 0e20aec8ef9c6c2f19641bfe1d2421cc0120205f..41bde15becac6b14c6b27a5779efe58125a25783 100644 (file)
@@ -150,6 +150,15 @@ _kiwi.view.ServerSelect = function () {
         },\r
 \r
         submitForm: function (event) {\r
+            event.preventDefault();\r
+\r
+            // Make sure a nick is chosen\r
+            if (!$('input.nick', this.$el).val().trim()) {\r
+                this.setStatus('Select a nickname first!');\r
+                $('input.nick', this.$el).select();\r
+                return;\r
+            }\r
+\r
             if (state === 'nick_change') {\r
                 this.submitNickChange(event);\r
             } else {\r
@@ -157,7 +166,7 @@ _kiwi.view.ServerSelect = function () {
             }\r
 \r
             $('button', this.$el).attr('disabled', 1);\r
-            return false;\r
+            return;\r
         },\r
 \r
         submitLogin: function (event) {\r
@@ -245,7 +254,7 @@ _kiwi.view.ServerSelect = function () {
             $('.status', this.$el)\r
                 .text(text)\r
                 .attr('class', 'status')\r
-                .addClass(class_name)\r
+                .addClass(class_name||'')\r
                 .show();\r
         },\r
         clearStatus: function () {\r