浏览代码

Merge pull request #639 from jitsi/external_connect_and_auth

Fixes issues when external connect and authentication are enabled
j8
yanas 9 年前
父节点
当前提交
0957ee7547
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7
    5
      connection.js

+ 7
- 5
connection.js 查看文件

@@ -31,6 +31,7 @@ function checkForAttachParametersAndConnect(id, password, connection) {
31 31
         var attachOptions = window.XMPPAttachInfo.data;
32 32
         if(attachOptions) {
33 33
             connection.attach(attachOptions);
34
+            delete window.XMPPAttachInfo.data;
34 35
         } else {
35 36
             connection.connect({id, password});
36 37
         }
@@ -51,11 +52,11 @@ function checkForAttachParametersAndConnect(id, password, connection) {
51 52
  */
52 53
 function connect(id, password, roomName) {
53 54
 
54
-    let connectionConfig = config;
55
+    let connectionConfig = Object.assign({}, config);
55 56
 
56 57
     connectionConfig.bosh += '?room=' + roomName;
57 58
     let connection
58
-        = new JitsiMeetJS.JitsiConnection(null, config.token, config);
59
+        = new JitsiMeetJS.JitsiConnection(null, config.token, connectionConfig);
59 60
 
60 61
     return new Promise(function (resolve, reject) {
61 62
         connection.addEventListener(
@@ -95,13 +96,14 @@ function connect(id, password, roomName) {
95 96
  * Show Authentication Dialog and try to connect with new credentials.
96 97
  * If failed to connect because of PASSWORD_REQUIRED error
97 98
  * then ask for password again.
99
+ * @param {string} [roomName]
98 100
  * @returns {Promise<JitsiConnection>}
99 101
  */
100
-function requestAuth() {
102
+function requestAuth(roomName) {
101 103
     return new Promise(function (resolve, reject) {
102 104
         let authDialog = LoginDialog.showAuthDialog(
103 105
             function (id, password) {
104
-                connect(id, password).then(function (connection) {
106
+                connect(id, password, roomName).then(function (connection) {
105 107
                     authDialog.close();
106 108
                     resolve(connection);
107 109
                 }, function (err) {
@@ -155,7 +157,7 @@ export function openConnection({id, password, retry, roomName}) {
155 157
             if (config.token) {
156 158
                 throw err;
157 159
             } else {
158
-                return requestAuth();
160
+                return requestAuth(roomName);
159 161
             }
160 162
         } else {
161 163
             throw err;

正在加载...
取消
保存