Fix incorrect password dialog message when using authentication.

This commit is contained in:
damencho 2017-03-07 16:42:36 -06:00
parent 9338b3cf94
commit 5f387737a1
1 changed files with 20 additions and 3 deletions

View File

@ -1,4 +1,5 @@
/* global $, APP, config */ /* global $, APP, config, JitsiMeetJS */
const ConnectionErrors = JitsiMeetJS.errors.connection;
/** /**
* Build html for "password required" dialog. * Build html for "password required" dialog.
@ -127,14 +128,30 @@ function LoginDialog(successCallback, cancelCallback) {
/** /**
* Displays error message in 'finished' state which allows either to cancel * Displays error message in 'finished' state which allows either to cancel
* or retry. * or retry.
* @param messageKey the key to the message to be displayed. * @param error the key to the error to be displayed.
* @param options the options to the error message (optional) * @param options the options to the error message (optional)
*/ */
this.displayError = function (messageKey, options) { this.displayError = function (error, options) {
let finishedState = connDialog.getState('finished'); let finishedState = connDialog.getState('finished');
let errorMessageElem = finishedState.find('#errorMessage'); let errorMessageElem = finishedState.find('#errorMessage');
let messageKey;
if (error === ConnectionErrors.PASSWORD_REQUIRED) {
// this is a password required error, as login window was already
// open once, this means username or password is wrong
messageKey = 'dialog.incorrectPassword';
}
else {
messageKey = 'dialog.connectErrorWithMsg';
if (!options)
options = {};
options.msg = error;
}
errorMessageElem.attr("data-i18n", messageKey); errorMessageElem.attr("data-i18n", messageKey);
APP.translation.translateElement($(errorMessageElem), options); APP.translation.translateElement($(errorMessageElem), options);