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

Emmanuel Kasper e.kasper at proxmox.com
Thu Aug 18 14:04:23 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)
---
change since v1:
 * also cleanup the status store
 * use removeAll() method to make our purpose clearer instead of loading
 an empty array

 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..894638b 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.removeAll();
 				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().removeAll();
+				    }
+				});
 			    }
 			}
 		    ]
-- 
2.1.4





More information about the pve-devel mailing list