Ver código fonte

Fix incorrect password dialog message when using authentication.

j8
damencho 8 anos atrás
pai
commit
5f387737a1
1 arquivos alterados com 20 adições e 3 exclusões
  1. 20
    3
      modules/UI/authentication/LoginDialog.js

+ 20
- 3
modules/UI/authentication/LoginDialog.js Ver arquivo

@@ -1,4 +1,5 @@
1
-/* global $, APP, config */
1
+/* global $, APP, config, JitsiMeetJS */
2
+const ConnectionErrors = JitsiMeetJS.errors.connection;
2 3
 
3 4
 /**
4 5
  * Build html for "password required" dialog.
@@ -127,14 +128,30 @@ function LoginDialog(successCallback, cancelCallback) {
127 128
     /**
128 129
      * Displays error message in 'finished' state which allows either to cancel
129 130
      * or retry.
130
-     * @param messageKey the key to the message to be displayed.
131
+     * @param error the key to the error to be displayed.
131 132
      * @param options the options to the error message (optional)
132 133
      */
133
-    this.displayError = function (messageKey, options) {
134
+    this.displayError = function (error, options) {
134 135
 
135 136
         let finishedState = connDialog.getState('finished');
136 137
 
137 138
         let errorMessageElem = finishedState.find('#errorMessage');
139
+
140
+        let messageKey;
141
+        if (error === ConnectionErrors.PASSWORD_REQUIRED) {
142
+            // this is a password required error, as login window was already
143
+            // open once, this means username or password is wrong
144
+            messageKey = 'dialog.incorrectPassword';
145
+        }
146
+        else {
147
+            messageKey = 'dialog.connectErrorWithMsg';
148
+
149
+            if (!options)
150
+                options = {};
151
+
152
+            options.msg = error;
153
+        }
154
+
138 155
         errorMessageElem.attr("data-i18n", messageKey);
139 156
 
140 157
         APP.translation.translateElement($(errorMessageElem), options);

Carregando…
Cancelar
Salvar