Browse Source

Fix incorrect password dialog message when using authentication.

j8
damencho 8 years ago
parent
commit
5f387737a1
1 changed files with 20 additions and 3 deletions
  1. 20
    3
      modules/UI/authentication/LoginDialog.js

+ 20
- 3
modules/UI/authentication/LoginDialog.js View File

1
-/* global $, APP, config */
1
+/* global $, APP, config, JitsiMeetJS */
2
+const ConnectionErrors = JitsiMeetJS.errors.connection;
2
 
3
 
3
 /**
4
 /**
4
  * Build html for "password required" dialog.
5
  * Build html for "password required" dialog.
127
     /**
128
     /**
128
      * Displays error message in 'finished' state which allows either to cancel
129
      * Displays error message in 'finished' state which allows either to cancel
129
      * or retry.
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
      * @param options the options to the error message (optional)
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
         let finishedState = connDialog.getState('finished');
136
         let finishedState = connDialog.getState('finished');
136
 
137
 
137
         let errorMessageElem = finishedState.find('#errorMessage');
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
         errorMessageElem.attr("data-i18n", messageKey);
155
         errorMessageElem.attr("data-i18n", messageKey);
139
 
156
 
140
         APP.translation.translateElement($(errorMessageElem), options);
157
         APP.translation.translateElement($(errorMessageElem), options);

Loading…
Cancel
Save