[pve-devel] [PATCH manager v3] Clear sensitive content when logging out fixes #1060

Emmanuel Kasper e.kasper at proxmox.com
Thu Aug 18 14:33:41 CEST 2016


The current position inside the Workspace is saved via the StateProvider
separately thus this clearing operation do not lose the previous selection.

As a side effect by calling setContent(null) on logout we also fix the
following bug:

when logging out while the Syslog tab of the Node panel was displayed,
you had to login twice due a to a race condition in the store
load of the Syslog panel. ( The login call could complete successfully
before a backgroup store load, causing the faild store load call
to redisplay a login window)
---
changes since V2:
 * don't call removeAll() to remove store items but erase the store items
 manually with an empty array because removeAll() keeps a copy of the removed
 items in a 'removed' store property, which kind of defeats the purpose of 
 the fix

 www/manager6/Workspace.js | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 61d345f..c23ea57 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -208,13 +208,10 @@ Ext.define('PVE.StdWorkspace', {
 		task.delay(10);
 	    }
 	}
-	// else {
-	    // TODO: display something useful
-
-	    // Note:: error mask has wrong zindex, so we do not
-	    // use that - see bug 114
-	    // PVE.Utils.setErrorMask(cont, 'nothing selected');
-	//}
+	else {
+	    // helper for cleaning the content when logging out
+	    cont.removeAll();
+	}
     },
 
     selectById: function(nodeid) {
@@ -417,11 +414,19 @@ Ext.define('PVE.StdWorkspace', {
 			    iconCls: 'fa fa-sign-out',
 			    text: gettext("Logout"),
 			    handler: function() { 
-				PVE.data.ResourceStore.stopUpdate();
+				PVE.data.ResourceStore.loadData([], false);
 				me.showLogin(); 
-				me.setContent(); 
+				me.setContent(null);
 				var rt = me.down('pveResourceTree');
 				rt.clearTree();
+
+				// empty the stores of the StatusPanel child items
+				var statusPanels = Ext.ComponentQuery.query('pveStatusPanel grid');
+				Ext.Array.forEach(statusPanels, function(comp) {
+				    if (comp.getStore()) {
+					comp.getStore().loadData([], false);
+				    }
+				});
 			    }
 			}
 		    ]
-- 
2.1.4





More information about the pve-devel mailing list