Merge pull request #639 from jitsi/external_connect_and_auth

Fixes issues when external connect and authentication are enabled
This commit is contained in:
yanas 2016-05-02 15:00:06 -05:00
commit 0957ee7547
1 changed files with 7 additions and 5 deletions

View File

@ -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<JitsiConnection>}
*/
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;