diff --git a/connection.js b/connection.js index d66dd24f3..5add17e48 100644 --- a/connection.js +++ b/connection.js @@ -31,6 +31,7 @@ function checkForAttachParametersAndConnect(id, password, connection) { var attachOptions = window.XMPPAttachInfo.data; if(attachOptions) { connection.attach(attachOptions); + delete window.XMPPAttachInfo.data; } else { connection.connect({id, password}); } @@ -51,11 +52,11 @@ function checkForAttachParametersAndConnect(id, password, connection) { */ function connect(id, password, roomName) { - let connectionConfig = config; + let connectionConfig = Object.assign({}, config); connectionConfig.bosh += '?room=' + roomName; let connection - = new JitsiMeetJS.JitsiConnection(null, config.token, config); + = new JitsiMeetJS.JitsiConnection(null, config.token, connectionConfig); return new Promise(function (resolve, reject) { connection.addEventListener( @@ -95,13 +96,14 @@ function connect(id, password, roomName) { * Show Authentication Dialog and try to connect with new credentials. * If failed to connect because of PASSWORD_REQUIRED error * then ask for password again. + * @param {string} [roomName] * @returns {Promise} */ -function requestAuth() { +function requestAuth(roomName) { return new Promise(function (resolve, reject) { let authDialog = LoginDialog.showAuthDialog( function (id, password) { - connect(id, password).then(function (connection) { + connect(id, password, roomName).then(function (connection) { authDialog.close(); resolve(connection); }, function (err) { @@ -155,7 +157,7 @@ export function openConnection({id, password, retry, roomName}) { if (config.token) { throw err; } else { - return requestAuth(); + return requestAuth(roomName); } } else { throw err;