Browse Source

Adds id and password initial login

j8
yanas 9 years ago
parent
commit
3408737693
1 changed files with 15 additions and 1 deletions
  1. 15
    1
      connection.js

+ 15
- 1
connection.js View File

22
         // When connection optimization is not deployed or enabled the default
22
         // When connection optimization is not deployed or enabled the default
23
         // value will be window.XMPPAttachInfo.status = "error"
23
         // value will be window.XMPPAttachInfo.status = "error"
24
         // If the connection optimization is deployed and enabled and there is
24
         // If the connection optimization is deployed and enabled and there is
25
-        // a failure the value will be window.XMPPAttachInfo.status = "error" 
25
+        // a failure the value will be window.XMPPAttachInfo.status = "error"
26
         if(window.XMPPAttachInfo.status === "error") {
26
         if(window.XMPPAttachInfo.status === "error") {
27
             connection.connect({id, password});
27
             connection.connect({id, password});
28
             return;
28
             return;
131
  * @returns {Promise<JitsiConnection>}
131
  * @returns {Promise<JitsiConnection>}
132
  */
132
  */
133
 export function openConnection({id, password, retry, roomName}) {
133
 export function openConnection({id, password, retry, roomName}) {
134
+
135
+    let predefinedLogin = window.localStorage.getItem("xmpp_login");
136
+    let predefinedPassword = window.localStorage.getItem("xmpp_password");
137
+
138
+    if (!id && predefinedLogin && predefinedLogin.length > 0) {
139
+        id = predefinedLogin;
140
+        window.localStorage.removeItem("xmpp_login");
141
+    }
142
+
143
+    if (!password && predefinedPassword && predefinedPassword.length > 0) {
144
+        password = predefinedPassword;
145
+        window.localStorage.removeItem("xmpp_password");
146
+    }
147
+
134
     return connect(id, password, roomName).catch(function (err) {
148
     return connect(id, password, roomName).catch(function (err) {
135
         if (!retry) {
149
         if (!retry) {
136
             throw err;
150
             throw err;

Loading…
Cancel
Save