Merge pull request #614 from jitsi/add-initial-id-pass-login

Adds id and password initial login
This commit is contained in:
hristoterezov 2016-04-20 15:06:23 -05:00
commit 846ec1c9c8
1 changed files with 13 additions and 1 deletions

View File

@ -22,7 +22,7 @@ function checkForAttachParametersAndConnect(id, password, connection) {
// When connection optimization is not deployed or enabled the default
// value will be window.XMPPAttachInfo.status = "error"
// If the connection optimization is deployed and enabled and there is
// a failure the value will be window.XMPPAttachInfo.status = "error"
// a failure the value will be window.XMPPAttachInfo.status = "error"
if(window.XMPPAttachInfo.status === "error") {
connection.connect({id, password});
return;
@ -131,6 +131,18 @@ function requestAuth() {
* @returns {Promise<JitsiConnection>}
*/
export function openConnection({id, password, retry, roomName}) {
let predefinedLogin = window.localStorage.getItem("xmpp_login");
let predefinedPassword = window.localStorage.getItem("xmpp_password");
if (!id && predefinedLogin && predefinedLogin.length > 0) {
id = predefinedLogin;
}
if (!password && predefinedPassword && predefinedPassword.length > 0) {
password = predefinedPassword;
}
return connect(id, password, roomName).catch(function (err) {
if (!retry) {
throw err;