|
|
|
@ -1,6 +1,5 @@ |
|
|
|
/* global APP, JitsiMeetJS, config */ |
|
|
|
/* global APP, JitsiMeetJS, config */ |
|
|
|
//FIXME:
|
|
|
|
import AuthHandler from './modules/UI/authentication/AuthHandler'; |
|
|
|
import LoginDialog from './modules/UI/authentication/LoginDialog'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ConnectionEvents = JitsiMeetJS.events.connection; |
|
|
|
const ConnectionEvents = JitsiMeetJS.events.connection; |
|
|
|
const ConnectionErrors = JitsiMeetJS.errors.connection; |
|
|
|
const ConnectionErrors = JitsiMeetJS.errors.connection; |
|
|
|
@ -92,33 +91,6 @@ 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(roomName) { |
|
|
|
|
|
|
|
return new Promise(function (resolve, reject) { |
|
|
|
|
|
|
|
let authDialog = LoginDialog.showAuthDialog( |
|
|
|
|
|
|
|
function (id, password) { |
|
|
|
|
|
|
|
connect(id, password, roomName).then(function (connection) { |
|
|
|
|
|
|
|
authDialog.close(); |
|
|
|
|
|
|
|
resolve(connection); |
|
|
|
|
|
|
|
}, function (err) { |
|
|
|
|
|
|
|
if (err === ConnectionErrors.PASSWORD_REQUIRED) { |
|
|
|
|
|
|
|
authDialog.displayError(err); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
authDialog.close(); |
|
|
|
|
|
|
|
reject(err); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Open JitsiConnection using provided credentials. |
|
|
|
* Open JitsiConnection using provided credentials. |
|
|
|
* If retry option is true it will show auth dialog on PASSWORD_REQUIRED error. |
|
|
|
* If retry option is true it will show auth dialog on PASSWORD_REQUIRED error. |
|
|
|
@ -157,7 +129,7 @@ export function openConnection({id, password, retry, roomName}) { |
|
|
|
if (config.token) { |
|
|
|
if (config.token) { |
|
|
|
throw err; |
|
|
|
throw err; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return requestAuth(roomName); |
|
|
|
return AuthHandler.requestAuth(roomName, connect); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw err; |
|
|
|
throw err; |
|
|
|
|