Browse Source

fixed desktop switch reset state

tobychui 2 năm trước cách đây
mục cha
commit
efd46e78d0
1 tập tin đã thay đổi với 22 bổ sung2 xóa
  1. 22 2
      web/desktop.system

+ 22 - 2
web/desktop.system

@@ -1227,7 +1227,7 @@
                         <div class="ui fluid small basic button" onclick="openSwitchAccountPanel(); hideToolPanel();"><i class="ui user plus icon"></i> Add another account</div>
                     </div>
                     <div class="item" style="margin-top: 0px !important;">
-                        <div class="ui fluid small black basic button"><i class="log out icon icon"></i> Sign-out all accounts</div>
+                        <div class="ui fluid small black basic button" onclick="logoutAllAccounts();"><i class="log out icon icon"></i> Sign-out all accounts</div>
                     </div>
                 </div>
             </div>
@@ -3265,7 +3265,10 @@
                 //Localstorage has interval setting that is not NaN
                 backgroundCrossfadeInterval = parseInt(localStorage.getItem("ao/desktop/backgroundInterval")) * 1000;
             }
-
+            if (backgroundIntervalCounter != undefined){
+                clearInterval(backgroundIntervalCounter);
+            }
+            
             backgroundIntervalCounter = setInterval(function() {
                 $("body").css("background-image", "none").css({
                     'background-color': '#000000'
@@ -7339,7 +7342,24 @@
                     }
                 }
             })
+        }
 
+        function logoutAllAccounts(){
+            if (confirm("This will logout all other accounts from this browser. Confirm?")){
+                $.ajax({
+                    url: "system/auth/u/logoutAll",
+                    data: {pid: getBrowserAccountPoolUUID()},
+                    success: function(data){
+                        if (data.error != undefined){
+                            alert(data.error);
+                        }else{
+                            //Reset the browser pool id
+                            localStorage.removeItem("ao_acc");
+                            listAllStoredAccounts();
+                        }
+                    }
+                })
+            }
         }
        
     </script>