diff --git a/app/index.html b/app/index.html index 7edd680..3c8ff2a 100644 --- a/app/index.html +++ b/app/index.html @@ -65,6 +65,64 @@ + +
+
+ Failed to connect +
+
+ + + + + + + + + + + + +
+ + The connection has been refused. + + + The server uses an incompatible version. + + + Your user name was rejected. Maybe try a different one? + + + The given password is incorrect. + The user name you have chosen requires a special one. + + + The given password is incorrect. + + + The user name you have chosen is already in use. + + + The server is full. + + + The server requires you to provide a client certificate + which is not supported by this web application. + +
+ The server reports: +
+ "" +
Username
Password
+ +
+
+
diff --git a/app/index.js b/app/index.js index fd81809..5b73307 100644 --- a/app/index.js +++ b/app/index.js @@ -38,6 +38,22 @@ function ConnectDialog () { } } +function ConnectErrorDialog (connectDialog) { + var self = this + self.type = ko.observable(0) + self.reason = ko.observable('') + self.username = connectDialog.username + self.password = connectDialog.password + self.joinOnly = connectDialog.joinOnly + self.visible = ko.observable(false) + self.show = self.visible.bind(self.visible, true) + self.hide = self.visible.bind(self.visible, false) + self.connect = () => { + self.hide() + connectDialog.connect() + } +} + function ConnectionInfo () { var self = this self.visible = ko.observable(false) @@ -131,6 +147,7 @@ class GlobalBindings { this.settings = new Settings() this.client = null this.connectDialog = new ConnectDialog() + this.connectErrorDialog = new ConnectErrorDialog(this.connectDialog) this.connectionInfo = new ConnectionInfo() this.commentDialog = new CommentDialog() this.settingsDialog = ko.observable() @@ -246,11 +263,13 @@ class GlobalBindings { this.client.setSelfMute(true) } }, err => { - if (err.type == 4) { - log('Connection error: invalid server password') - } else { - log('Connection error:', err) - } + if (err.$type && err.$type.name === 'Reject') { + this.connectErrorDialog.type(err.type) + this.connectErrorDialog.reason(err.reason) + this.connectErrorDialog.show() + } else { + log('Connection error:', err) + } }) } diff --git a/themes/MetroMumbleLight/main.css b/themes/MetroMumbleLight/main.css index dfe232f..d124df3 100644 --- a/themes/MetroMumbleLight/main.css +++ b/themes/MetroMumbleLight/main.css @@ -303,3 +303,7 @@ form { padding: 2px; width: calc(100% - 8px); } +.connect-dialog.error-dialog { + width: 400px; + left: calc(50% - 200px); +}