Sfoglia il codice sorgente

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

Adds id and password initial login
master
hristoterezov 9 anni fa
parent
commit
846ec1c9c8
1 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 13
    1
      connection.js

+ 13
- 1
connection.js Vedi File

@@ -22,7 +22,7 @@ function checkForAttachParametersAndConnect(id, password, connection) {
22 22
         // When connection optimization is not deployed or enabled the default
23 23
         // value will be window.XMPPAttachInfo.status = "error"
24 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 26
         if(window.XMPPAttachInfo.status === "error") {
27 27
             connection.connect({id, password});
28 28
             return;
@@ -131,6 +131,18 @@ function requestAuth() {
131 131
  * @returns {Promise<JitsiConnection>}
132 132
  */
133 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
+    }
141
+
142
+    if (!password && predefinedPassword && predefinedPassword.length > 0) {
143
+        password = predefinedPassword;
144
+    }
145
+
134 146
     return connect(id, password, roomName).catch(function (err) {
135 147
         if (!retry) {
136 148
             throw err;

Loading…
Annulla
Salva