فهرست منبع

Fixing everything with account switch

Toby Chui 2 سال پیش
والد
کامیت
87d1de2bea
4فایلهای تغییر یافته به همراه198 افزوده شده و 145 حذف شده
  1. 88 15
      mod/auth/accountSwitch.go
  2. 12 2
      mod/auth/auth.go
  3. 45 60
      web/SystemAO/advance/switchAccount.html
  4. 53 68
      web/desktop.system

+ 88 - 15
mod/auth/accountSwitch.go

@@ -8,6 +8,7 @@ import (
 	"net/http"
 	"time"
 
+	"github.com/gorilla/sessions"
 	uuid "github.com/satori/go.uuid"
 	"imuslab.com/arozos/mod/database"
 	"imuslab.com/arozos/mod/utils"
@@ -35,23 +36,31 @@ type SwitchableAccount struct {
 
 type SwitchableAccountsPool struct {
 	UUID     string               //UUID of this pool, one pool per browser instance
+	Creator  string               //The user who created the pool. When logout, the pool is discarded
 	Accounts []*SwitchableAccount //Accounts that is cross switchable in this pool
 	parent   *SwitchableAccountPoolManager
 }
 
 type SwitchableAccountPoolManager struct {
-	Database   *database.Database
-	ExpireTime int64 //Expire time of the switchable account
-	authAgent  *AuthAgent
+	SessionStore *sessions.CookieStore
+	SessionName  string
+	Database     *database.Database
+	ExpireTime   int64 //Expire time of the switchable account
+	authAgent    *AuthAgent
 }
 
 // Create a new switchable account pool manager
-func NewSwitchableAccountPoolManager(sysdb *database.Database, parent *AuthAgent) *SwitchableAccountPoolManager {
+func NewSwitchableAccountPoolManager(sysdb *database.Database, parent *AuthAgent, key []byte) *SwitchableAccountPoolManager {
+	//Create new database table
 	sysdb.NewTable("auth_acswitch")
+
+	//Create new session store
 	thisManager := SwitchableAccountPoolManager{
-		Database:   sysdb,
-		ExpireTime: 604800,
-		authAgent:  parent,
+		SessionStore: sessions.NewCookieStore(key),
+		SessionName:  "ao_acc",
+		Database:     sysdb,
+		ExpireTime:   604800,
+		authAgent:    parent,
 	}
 
 	//Do an initialization cleanup
@@ -85,8 +94,9 @@ func (m *SwitchableAccountPoolManager) HandleSwitchableAccountListing(w http.Res
 		return
 	}
 
-	poolid, err := utils.GetPara(r, "pid")
-	if err != nil {
+	session, _ := m.SessionStore.Get(r, m.SessionName)
+	poolid, ok := session.Values["poolid"].(string)
+	if !ok {
 		utils.SendErrorResponse(w, "invalid pool id given")
 		return
 	}
@@ -94,16 +104,25 @@ func (m *SwitchableAccountPoolManager) HandleSwitchableAccountListing(w http.Res
 	//Check pool exists
 	targetPool, err := m.GetPoolByID(poolid)
 	if err != nil {
+		//Pool expired. Unset the session
+		session.Values["poolid"] = nil
+		session.Save(r, w)
 		utils.SendErrorResponse(w, err.Error())
 		return
 	}
 
 	//Check if the user can access this pool
 	if !targetPool.IsAccessibleBy(currentUsername) {
-		utils.SendErrorResponse(w, "permission denied")
+		//Unset the session
+		session.Values["poolid"] = nil
+		session.Save(r, w)
+		utils.SendErrorResponse(w, "access denied")
 		return
 	}
 
+	//Update the user Last Switch Time
+	targetPool.UpdateUserLastSwitchTime(currentUsername)
+
 	//OK. List all the information about the pool
 	type AccountInfo struct {
 		Username  string
@@ -121,6 +140,43 @@ func (m *SwitchableAccountPoolManager) HandleSwitchableAccountListing(w http.Res
 	utils.SendJSONResponse(w, string(js))
 }
 
+// Handle logout of the current user, return the fallback user if any
+func (m *SwitchableAccountPoolManager) HandleLogoutforUser(w http.ResponseWriter, r *http.Request) (string, error) {
+	currentUsername, err := m.authAgent.GetUserName(w, r)
+	if err != nil {
+		return "", err
+	}
+
+	session, _ := m.SessionStore.Get(r, m.SessionName)
+	poolid, ok := session.Values["poolid"].(string)
+	if !ok {
+		return "", errors.New("user not in a any switchable account pool")
+	}
+
+	//Get the target pool
+	targetpool, err := m.GetPoolByID(poolid)
+	if err != nil {
+		return "", err
+	}
+
+	//Remove the user from the pool
+	targetpool.RemoveUser(currentUsername)
+
+	//Check if the logout user is the creator. If yes, remove the pool
+	if targetpool.Creator == currentUsername {
+		targetpool.Delete()
+
+		//Unset the session
+		session.Values["poolid"] = nil
+		session.Save(r, w)
+
+		return "", nil
+	}
+
+	//return the creator so after logout, the client is switched back to the master account
+	return targetpool.Creator, nil
+}
+
 // Logout all the accounts in the pool
 func (m *SwitchableAccountPoolManager) HandleLogoutAllAccounts(w http.ResponseWriter, r *http.Request) {
 	currentUsername, err := m.authAgent.GetUserName(w, r)
@@ -128,9 +184,12 @@ func (m *SwitchableAccountPoolManager) HandleLogoutAllAccounts(w http.ResponseWr
 		utils.SendErrorResponse(w, err.Error())
 		return
 	}
-	poolid, err := utils.PostPara(r, "pid")
-	if err != nil {
+
+	session, _ := m.SessionStore.Get(r, m.SessionName)
+	poolid, ok := session.Values["poolid"].(string)
+	if !ok {
 		utils.SendErrorResponse(w, "invalid pool id given")
+		return
 	}
 
 	//Get the target pool
@@ -148,6 +207,10 @@ func (m *SwitchableAccountPoolManager) HandleLogoutAllAccounts(w http.ResponseWr
 	//Remove the pool
 	targetpool.Delete()
 
+	//Unset the session
+	session.Values["poolid"] = nil
+	session.Save(r, w)
+
 	utils.SendOK(w)
 }
 
@@ -158,12 +221,15 @@ func (m *SwitchableAccountPoolManager) HandleAccountSwitch(w http.ResponseWriter
 		utils.SendErrorResponse(w, err.Error())
 		return
 	}
-	poolid, err := utils.PostPara(r, "pid")
-	if err != nil {
+
+	session, _ := m.SessionStore.Get(r, m.SessionName)
+	poolid, ok := session.Values["poolid"].(string)
+	if !ok {
 		//No pool is given. Generate a pool for this request
 		poolid = uuid.NewV4().String()
 		newPool := SwitchableAccountsPool{
-			UUID: poolid,
+			UUID:    poolid,
+			Creator: previousUserName,
 			Accounts: []*SwitchableAccount{
 				{
 					Username:   previousUserName,
@@ -174,6 +240,13 @@ func (m *SwitchableAccountPoolManager) HandleAccountSwitch(w http.ResponseWriter
 		}
 
 		newPool.Save()
+
+		session.Values["poolid"] = poolid
+		session.Options = &sessions.Options{
+			MaxAge: 3600 * 24 * 30, //One month
+			Path:   "/",
+		}
+		session.Save(r, w)
 	}
 
 	//Get switchable pool from manager

+ 12 - 2
mod/auth/auth.go

@@ -133,7 +133,7 @@ func NewAuthenticationAgent(sessionName string, key []byte, sysdb *db.Database,
 		Logger: newLogger,
 	}
 
-	poolManager := NewSwitchableAccountPoolManager(sysdb, &newAuthAgent)
+	poolManager := NewSwitchableAccountPoolManager(sysdb, &newAuthAgent, key)
 	newAuthAgent.SwitchableAccountManager = poolManager
 
 	//Create a timer to listen to its token storage
@@ -304,7 +304,7 @@ func (a *AuthAgent) LoginUserByRequest(w http.ResponseWriter, r *http.Request, u
 	session.Values["rememberMe"] = rememberme
 
 	//Check if remember me is clicked. If yes, set the maxage to 1 week.
-	if rememberme == true {
+	if rememberme {
 		session.Options = &sessions.Options{
 			MaxAge: 3600 * 24 * 7, //One week
 			Path:   "/",
@@ -324,6 +324,10 @@ func (a *AuthAgent) HandleLogout(w http.ResponseWriter, r *http.Request) {
 	if username != "" {
 		log.Println(username + " logged out.")
 	}
+
+	//Clear user switchable account pools
+	fallbackAccount, _ := a.SwitchableAccountManager.HandleLogoutforUser(w, r)
+
 	// Revoke users authentication
 	err := a.Logout(w, r)
 	if err != nil {
@@ -331,6 +335,11 @@ func (a *AuthAgent) HandleLogout(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
+	if fallbackAccount != "" {
+		//Switch to fallback account
+		a.LoginUserByRequest(w, r, fallbackAccount, true)
+	}
+
 	w.Write([]byte("OK"))
 }
 
@@ -342,6 +351,7 @@ func (a *AuthAgent) Logout(w http.ResponseWriter, r *http.Request) error {
 	session.Values["authenticated"] = false
 	session.Values["username"] = nil
 	session.Save(r, w)
+
 	return nil
 }
 

+ 45 - 60
web/SystemAO/advance/switchAccount.html

@@ -38,7 +38,7 @@
         */
 
         body.darkTheme .ui.segment{
-            background-color: var(--body_background_secondary);
+            background-color: var(--body_background_active);
             color: var(--text_color);
         }
 
@@ -143,7 +143,6 @@
         //and change to another user account, it is still based on the session value
         //matched by cookie ao_auth on server side
         let currentUserInfo = {};
-        let browserAccountPoolUUID = localStorage.getItem("ao_acc");
         
         //Initalized localization
         if (typeof(applocale) != "undefined"){
@@ -187,17 +186,12 @@
                 data: {
                     username: username,
                     password: password,
-                    pid: (browserAccountPoolUUID!=undefined)?browserAccountPoolUUID:"",
                 },
                 success: function(data){
                     if (data.error != undefined){
                         $("#errtext").text(data.error);
                         $("#errmsg").show();
                     }else{
-                        //The returned value is the pool id. Save it to localstorage
-                        console.log("Setting browser switch pool id to " + data)
-                        localStorage.setItem("ao_acc", data)
-                        browserAccountPoolUUID = data;
                         //Refresh the page
                         $("#errmsg").hide();
                         initCurrentAccountInfo(function(){
@@ -230,7 +224,6 @@
                 url: "../../system/auth/u/switch",
                 data: {
                     "username": targetUsername,
-                    "pid": browserAccountPoolUUID,
                 },
                 success: function(data){
                     if (data.error != undefined){
@@ -253,16 +246,16 @@
             if (confirm(applocale.getString("msg/logout/confirm", "This will logout all other accounts from this browser. Confirm?"))){
                 $.ajax({
                     url: "/system/auth/u/logoutAll",
-                    data: {pid: browserAccountPoolUUID},
                     success: function(data){
                         if (data.error != undefined){
                             showError(data.error);
                         }else{
                             //Reset the browser pool id
-                            browserAccountPoolUUID = undefined;
-                            localStorage.removeItem("ao_acc");
                             hideError();
                             listAllStoredAccounts();
+                            if(ao_module_virtualDesktop){
+                                parent.initDesktop();
+                            }
                         }
                     }
                 })
@@ -283,61 +276,53 @@
 
         function listAllStoredAccounts(){
             $("#alternativeAccountList").empty();
-            if (browserAccountPoolUUID == undefined){
-                 //Empty or no stored accounts
-                 $("#alternativeAccountList").append(`<div class="ui message">
-                    <i class="ui green check circle icon"></i> ${applocale.getString("desc/noAlternative", "No other account stored on this browser")}
-                </div>`);
-                $("#signoutAllButton").addClass('disabled');
-                return;
-            }else{
-                //Request server side for the account pool
-                $.get("../../system/auth/u/list?pid=" + browserAccountPoolUUID, function(data){
-                    if (data.error != undefined){
-                        localStorage.removeItem("ao_acc");
+        
+            //Request server side for the account pool
+            $.get("../../system/auth/u/list", function(data){
+                if (data.error != undefined){
+                    $("#signoutAllButton").addClass('disabled');
+                    $("#alternativeAccountList").append(`<div class="ui message">
+                        <i class="ui green check circle icon"></i> ${applocale.getString("desc/noAlternative", "No other account stored on this browser")}
+                    </div>`);
+                    return;
+                }else{
+                    if (data.length > 0){
+                        data.forEach(function(account){
+                            if (account.Username == currentUserInfo.username){
+                                //Skip
+                                return;
+                            }
+                            
+                            $.get("../../system/desktop/user?target=" + account.Username, function(data){
+                                let userIcon = data.UserIcon;
+                                if (userIcon == ""){
+                                    userIcon = "../../img/desktop/system_icon/user.svg"
+                                }
+                                $("#alternativeAccountList").append(`
+                                    <div class="alternativeAccount ${account.IsExpired?"expired":""}" acname="${account.Username}" onclick="switchAccount(this);">
+                                        <div class="ui header">
+                                            <img class="usericon" src="${userIcon}">
+                                            <div class="content" style="font-size: 95% !important;">
+                                                <span class="username">${account.Username}</span> ${(data.IsAdmin)?'<i style="margin-left: 0.4em; color: rgb(38, 50, 56);" class="small shield alternate icon themed text isAdminIcon"></i>':""}
+                                                <div class="sub header usergroup">${!account.IsExpired?"<i class='ui green check circle icon' style='margin-right: 0px;'></i> " + applocale.getString("desc/sessionValid", "Session Valid"):"<i class='ui red times circle icon' style='margin-right: 0px;'></i> " + applocale.getString("desc/sessionExpired", "Session Expired")}</div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                `);
+                            });
+                        });
+                        $("#signoutAllButton").removeClass('disabled');
+                    }else{
                         $("#signoutAllButton").addClass('disabled');
                         $("#alternativeAccountList").append(`<div class="ui message">
                             <i class="ui green check circle icon"></i> ${applocale.getString("desc/noAlternative", "No other account stored on this browser")}
                         </div>`);
                         return;
-                    }else{
-                        if (data.length > 0){
-                            data.forEach(function(account){
-                                if (account.Username == currentUserInfo.username){
-                                    //Skip
-                                    return;
-                                }
-                               
-                                $.get("../../system/desktop/user?target=" + account.Username, function(data){
-                                    let userIcon = data.UserIcon;
-                                    if (userIcon == ""){
-                                        userIcon = "../../img/desktop/system_icon/user.svg"
-                                    }
-                                    $("#alternativeAccountList").append(`
-                                        <div class="alternativeAccount ${account.IsExpired?"expired":""}" acname="${account.Username}" onclick="switchAccount(this);">
-                                            <div class="ui header">
-                                                <img class="usericon" src="${userIcon}">
-                                                <div class="content" style="font-size: 95% !important;">
-                                                    <span class="username">${account.Username}</span> ${(data.IsAdmin)?'<i style="margin-left: 0.4em; color: rgb(38, 50, 56);" class="small shield alternate icon themed text isAdminIcon"></i>':""}
-                                                    <div class="sub header usergroup">${!account.IsExpired?"<i class='ui green check circle icon' style='margin-right: 0px;'></i> " + applocale.getString("desc/sessionValid", "Session Valid"):"<i class='ui red times circle icon' style='margin-right: 0px;'></i> " + applocale.getString("desc/sessionExpired", "Session Expired")}</div>
-                                                </div>
-                                            </div>
-                                        </div>
-                                    `);
-                                });
-                            });
-                            $("#signoutAllButton").removeClass('disabled');
-                        }else{
-                            $("#signoutAllButton").addClass('disabled');
-                            $("#alternativeAccountList").append(`<div class="ui message">
-                                <i class="ui green check circle icon"></i> ${applocale.getString("desc/noAlternative", "No other account stored on this browser")}
-                            </div>`);
-                            return;
-                        }
                     }
-                })
-            }
+                }
+            })
         }
+        
 
         function initCurrentAccountInfo(callback=undefined){
             $.get("../../system/desktop/user", function(data){
@@ -377,7 +362,7 @@
             loggingOut = true;
             if (confirm(applocale.getString("msg/logout/thisAcConfirm", "Exiting Session. Confirm?"))){
                 $.get("../../system/auth/logout", function() {
-                    window.location.href = "./";
+                    window.top.location.href = "../../";
                 });
             }
             hideAllContextMenus();

+ 53 - 68
web/desktop.system

@@ -661,6 +661,10 @@
             pointer-events: auto;
         }
 
+        body.whiteTheme .item:hover{
+            background-color: #ececec !important;
+        }
+
         @supports not (backdrop-filter: blur(2px)) {
             .notificationbar .cover{
                 /*
@@ -866,6 +870,12 @@
             border: 0px;
         }
 
+        .alternativeAccount.item{
+            padding-top: 0.6em !important;
+            padding-bottom: 0.6em !important;
+            margin: 0;
+        }
+
         /* File operation progress tracker */
         #backgroundTaskPanel{
             background-color: var(--body_background) !important;
@@ -1198,7 +1208,7 @@
                     <img class="usericon" src="img/desktop/system_icon/user.svg">
                 </div>
                 <div class="content" style="padding-left: 1em;">
-                    <div id="username" class="header" style="font-weight: 500; font-size: 1.22em;">User</div>
+                    <div id="username" class="header" style="font-weight: 600; font-size: 1.22em;">User</div>
                     <div class="meta" style="margin-top: 0.15em;">
                         <div id="usergroups">@Users</div>
                     </div>
@@ -1210,22 +1220,10 @@
                 </div>
             </div>
             <div class="ui divider"></div>
-            <div class="item" style="padding-left: 8px;">
-                <div id="alternativeAccountList" class="ui small items" style="margin-bottom: 0; padding-bottom: 8px; width: 100%;">
-                    <div class="alternativeUsableAccount item"  style="padding-left: 0px;">
-                        <div class="ui mini image">
-                            <img class="accountIcon" src="img/desktop/system_icon/user.svg">
-                        </div>
-                        <div class="content" style="padding-left: 1em;">
-                            <div class="header accountName" style="font-weight: 500; font-size: 1em;">User</div>
-                            <div class="meta" style="margin-top: 0.15em;">
-                                <div class="accountGroups">@Users</div>
-                            </div>
-                        </div>
-                    </div>
-                </div>
+            <div id="alternativeAccountList">
+               
             </div>
-            <div class="ui divider" style="margin-left: 2em; margin-right: 2em;"></div>
+            <div class="ui divider" style="margin-left: 3em; margin-right: 3em;"></div>
             <div class="item" style="padding-top: 6px; padding-bottom:6px; margin: 0px !important;" onclick="openSwitchAccountPanel(); hideToolPanel();">
                 <i class="ui user plus icon" style="margin-right: 0.6em;"></i> <span locale="account/switch/addAccount">Add another account</span>
             </div>
@@ -1855,10 +1853,10 @@
         }
 
         function hookLaunchMenuEvents(){
-            $(".groupType").on("click touchstart",function(){
+            $(".groupType").off("click touchstart").on("click touchstart",function(){
                 moduleTypeButtonClicked(this);
             });
-            $(".poweroption").on("click touchstart",function(){
+            $(".poweroption").off("click touchstart").on("click touchstart",function(){
                 logout();
             });
         }
@@ -7261,61 +7259,50 @@
         /*
             Alternative account manager
         */
-        function getBrowserAccountPoolUUID(){
-            return localStorage.getItem("ao_acc");
-        }
         function listAllStoredAccounts(){
             $("#alternativeAccountList").empty();
-            if (getBrowserAccountPoolUUID() == undefined){
-                 //Empty or no stored accounts
-                 $("#alternativeAccountList").append(`<i class="ui green check circle icon"></i> ${applocale.getString("account/switch/noAlternative", "No other account stored on this browser")}`);
-                 $("#alternativeAccountList").css("padding-top", "8px");
-                 $("#signoutAllButton").addClass('disabled');
-                 return;
-            }else{
-                //Request server side for the account pool
-                $.get("system/auth/u/list?pid=" + getBrowserAccountPoolUUID(), function(data){
-                    if (data.error != undefined){
-                        $("#alternativeAccountList").append(`<i class="ui green check circle icon"></i> ${applocale.getString("account/switch/noAlternative", "No other account stored on this browser")}`);
-                        $("#alternativeAccountList").css("padding-top", "8px");
-                        //This uuid no longer exists or it has been expired and removed by backend server/
-                        localStorage.removeItem("ao_acc");
-                    }else{
-                        if (data.length > 0){
-                            data.forEach(function(account){
-                                if (account.Username == userInfo.Username){
-                                    //Skip
-                                    return;
+            //Request server side for the account pool
+            $.get("system/auth/u/list", function(data){
+                if (data.error != undefined){
+                    $("#alternativeAccountList").append(`<div style="padding: 0.4em; padding-left: 1em; padding-right: 1em;">
+                            <i class="ui green check circle icon"></i> ${applocale.getString("account/switch/noAlternative", "No other account stored on this browser")}
+                    </div>`);
+                    $("#signoutAllButton").addClass('disabled');
+                }else{
+                    if (data.length > 1){
+                        data.forEach(function(account){
+                            if (account.Username == userInfo.Username){
+                                //Skip
+                                return;
+                            }
+                            $.get("system/desktop/user?target=" + account.Username, function(data){
+                                let userIcon = data.UserIcon;
+                                if (userIcon == ""){
+                                    userIcon = "img/desktop/system_icon/user.svg"
                                 }
-                                $("#alternativeAccountList").css("padding-top", "0px");
-                                $.get("system/desktop/user?target=" + account.Username, function(data){
-                                    let userIcon = data.UserIcon;
-                                    if (userIcon == ""){
-                                        userIcon = "img/desktop/system_icon/user.svg"
-                                    }
-                                    $("#alternativeAccountList").append(`
-                                        <div class="alternativeAccount ${account.IsExpired?"expired":""}" acname="${account.Username}" onclick="switchAccount(this);" style="margin-top: 0.6em;">
-                                            <div class="ui header">
-                                                <img class="usericon ui circular image" src="${userIcon}">
-                                                <div class="content" style="font-size: 95% !important;">
-                                                    <span class="username">${account.Username}</span> ${(data.IsAdmin)?'<i style="margin-left: 0.4em; color: rgb(38, 50, 56);" title="Admin" class="small shield alternate icon themed text"></i>':""}
-                                                    <div class="sub header usergroup">${!account.IsExpired?"<i class='ui green check circle icon' style='margin-right: 0px;'></i> " + applocale.getString("account/switch/sessionValid", "Session Valid"):"<i class='ui red times circle icon' style='margin-right: 0px;'></i> " + applocale.getString("account/switch/sessionExpired", "Session Expired")}</div>
-                                                </div>
+                                $("#alternativeAccountList").append(`
+                                    <div class="alternativeAccount item ${account.IsExpired?"expired":""}" acname="${account.Username}" onclick="switchAccount(this);">
+                                        <div class="ui header">
+                                            <img class="usericon ui circular image" src="${userIcon}">
+                                            <div class="content" style="font-size: 95% !important;">
+                                                <span class="username">${account.Username}</span> ${(data.IsAdmin)?'<i style="margin-left: 0.4em; color: rgb(38, 50, 56);" title="Admin" class="small shield alternate icon themed text"></i>':""}
+                                                <div class="sub header usergroup">${!account.IsExpired?"<i class='ui green check circle icon' style='margin-right: 0px;'></i> " + applocale.getString("account/switch/sessionValid", "Session Valid"):"<i class='ui red times circle icon' style='margin-right: 0px;'></i> " + applocale.getString("account/switch/sessionExpired", "Session Expired")}</div>
                                             </div>
                                         </div>
-                                    `);
-                                });
+                                    </div>
+                                `);
                             });
-                            $("#signoutAllButton").removeClass('disabled');
-                        }else{
-                            $("#signoutAllButton").addClass('disabled');
-                            $("#alternativeAccountList").css("padding-top", "8px");
-                            $("#alternativeAccountList").append(`<i class="ui green check circle icon"></i> ${applocale.getString("account/switch/noAlternative", "No other account stored on this browser")}`);
-                            return;
-                        }
+                        });
+                        $("#signoutAllButton").removeClass('disabled');
+                    }else{
+                        $("#signoutAllButton").addClass('disabled');
+                        $("#alternativeAccountList").append(`<div style="padding: 0.4em; padding-left: 1em; padding-right: 1em;">
+                            <i class="ui green check circle icon"></i> ${applocale.getString("account/switch/noAlternative", "No other account stored on this browser")}
+                        </div>`);
+                        return;
                     }
-                })
-            }
+                }
+            })
         }
 
         function switchAccount(object){
@@ -7335,7 +7322,6 @@
                 url: "system/auth/u/switch",
                 data: {
                     "username": targetUsername,
-                    "pid": getBrowserAccountPoolUUID(),
                 },
                 success: function(data){
                     if (data.error != undefined){
@@ -7351,7 +7337,6 @@
             if (confirm(applocale.getString("account/switch/logout/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);