浏览代码

Fixes authentication issues.

j8
hristoterezov 10 年前
父节点
当前提交
4bb555e4b2
共有 2 个文件被更改,包括 26 次插入20 次删除
  1. 13
    10
      libs/app.bundle.js
  2. 13
    10
      modules/xmpp/xmpp.js

+ 13
- 10
libs/app.bundle.js 查看文件

15676
 
15676
 
15677
 function connect(jid, password, uiCredentials) {
15677
 function connect(jid, password, uiCredentials) {
15678
     var bosh
15678
     var bosh
15679
-        = uiCredentials.bosh || config.bosh || '/http-bind';
15679
+        = (uiCredentials && uiCredentials.bosh? uiCredentials.bosh : null)
15680
+        || config.bosh || '/http-bind';
15680
     connection = new Strophe.Connection(bosh);
15681
     connection = new Strophe.Connection(bosh);
15681
     Moderator.setConnection(connection);
15682
     Moderator.setConnection(connection);
15682
 
15683
 
15683
-    var email = uiCredentials.email;
15684
-    var displayName = uiCredentials.displayName;
15685
-    if(email) {
15686
-        connection.emuc.addEmailToPresence(email);
15687
-    } else {
15688
-        connection.emuc.addUserIdToPresence(uiCredentials.uid);
15689
-    }
15690
-    if(displayName) {
15691
-        connection.emuc.addDisplayNameToPresence(displayName);
15684
+    if(uiCredentials) {
15685
+        var email = uiCredentials.email;
15686
+        var displayName = uiCredentials.displayName;
15687
+        if (email) {
15688
+            connection.emuc.addEmailToPresence(email);
15689
+        } else {
15690
+            connection.emuc.addUserIdToPresence(uiCredentials.uid);
15691
+        }
15692
+        if (displayName) {
15693
+            connection.emuc.addDisplayNameToPresence(displayName);
15694
+        }
15692
     }
15695
     }
15693
 
15696
 
15694
     if (connection.disco) {
15697
     if (connection.disco) {

+ 13
- 10
modules/xmpp/xmpp.js 查看文件

13
 
13
 
14
 function connect(jid, password, uiCredentials) {
14
 function connect(jid, password, uiCredentials) {
15
     var bosh
15
     var bosh
16
-        = uiCredentials.bosh || config.bosh || '/http-bind';
16
+        = (uiCredentials && uiCredentials.bosh? uiCredentials.bosh : null)
17
+        || config.bosh || '/http-bind';
17
     connection = new Strophe.Connection(bosh);
18
     connection = new Strophe.Connection(bosh);
18
     Moderator.setConnection(connection);
19
     Moderator.setConnection(connection);
19
 
20
 
20
-    var email = uiCredentials.email;
21
-    var displayName = uiCredentials.displayName;
22
-    if(email) {
23
-        connection.emuc.addEmailToPresence(email);
24
-    } else {
25
-        connection.emuc.addUserIdToPresence(uiCredentials.uid);
26
-    }
27
-    if(displayName) {
28
-        connection.emuc.addDisplayNameToPresence(displayName);
21
+    if(uiCredentials) {
22
+        var email = uiCredentials.email;
23
+        var displayName = uiCredentials.displayName;
24
+        if (email) {
25
+            connection.emuc.addEmailToPresence(email);
26
+        } else {
27
+            connection.emuc.addUserIdToPresence(uiCredentials.uid);
28
+        }
29
+        if (displayName) {
30
+            connection.emuc.addDisplayNameToPresence(displayName);
31
+        }
29
     }
32
     }
30
 
33
 
31
     if (connection.disco) {
34
     if (connection.disco) {

正在加载...
取消
保存