Pārlūkot izejas kodu

Adds id and password initial login

j8
yanas 9 gadus atpakaļ
vecāks
revīzija
3408737693
1 mainītis faili ar 15 papildinājumiem un 1 dzēšanām
  1. 15
    1
      connection.js

+ 15
- 1
connection.js Parādīt failu

@@ -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,20 @@ 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
+        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 148
     return connect(id, password, roomName).catch(function (err) {
135 149
         if (!retry) {
136 150
             throw err;

Notiek ielāde…
Atcelt
Saglabāt