On 1/25/18 2:38 PM, Dominik Csapak wrote: > this is now all in the widget-toolkit and needs to be > set/read to/from there, else we possibly get an inconsistent view on > those > > this fixes as issue, where after login the ResourceStore would not update > > Signed-off-by: Dominik Csapak <[email protected]>
Thanks to Wolfgang for catching this! Reviewed-by: Thomas Lamprecht <[email protected]> Tested-by: Thomas Lamprecht <[email protected]> > --- > www/index.html.tpl | 2 -- > www/manager6/Utils.js | 9 --------- > www/manager6/Workspace.js | 14 +++++++------- > www/manager6/lxc/Resources.js | 2 +- > www/manager6/node/Config.js | 2 +- > www/mobile/Workspace.js | 6 +++--- > www/touch/index.html.tpl | 2 -- > 7 files changed, 12 insertions(+), 25 deletions(-) > > diff --git a/www/index.html.tpl b/www/index.html.tpl > index 147d3492..a972e3aa 100644 > --- a/www/index.html.tpl > +++ b/www/index.html.tpl > @@ -36,8 +36,6 @@ > > <script type="text/javascript"> > if (typeof(PVE) === 'undefined') PVE = {}; > - PVE.UserName = '[% username %]' > - PVE.CSRFPreventionToken = '[% token %]'; > Ext.History.fieldid = 'x-history-field'; > Ext.onReady(function() { Ext.create('PVE.StdWorkspace');}); > </script> > diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js > index 1d67238e..8f80c76a 100644 > --- a/www/manager6/Utils.js > +++ b/www/manager6/Utils.js > @@ -20,15 +20,6 @@ Ext.Ajax.defaultHeaders = { > 'Accept': 'application/json' > }; > > -Ext.Ajax.on('beforerequest', function(conn, options) { > - if (PVE.CSRFPreventionToken) { > - if (!options.headers) { > - options.headers = {}; > - } > - options.headers.CSRFPreventionToken = PVE.CSRFPreventionToken; > - } > -}); > - > Ext.define('PVE.Utils', { utilities: { > > // this singleton contains miscellaneous utilities > diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js > index 8d6bb4d1..c7b88761 100644 > --- a/www/manager6/Workspace.js > +++ b/www/manager6/Workspace.js > @@ -19,8 +19,8 @@ Ext.define('PVE.Workspace', { > updateLoginData: function(loginData) { > var me = this; > me.loginData = loginData; > - PVE.CSRFPreventionToken = loginData.CSRFPreventionToken; > - PVE.UserName = loginData.username; > + Proxmox.CSRFPreventionToken = loginData.CSRFPreventionToken; > + Proxmox.UserName = loginData.username; > > if (loginData.cap) { > Ext.state.Manager.set('GuiCap', loginData.cap); > @@ -37,7 +37,7 @@ Ext.define('PVE.Workspace', { > var me = this; > > Proxmox.Utils.authClear(); > - PVE.UserName = null; > + Proxmox.UserName = null; > me.loginData = null; > > if (!me.login) { > @@ -78,13 +78,13 @@ Ext.define('PVE.Workspace', { > Ext.TaskManager.start({ > run: function() { > var ticket = Proxmox.Utils.authOK(); > - if (!ticket || !PVE.UserName) { > + if (!ticket || !Proxmox.UserName) { > return; > } > > Ext.Ajax.request({ > params: { > - username: PVE.UserName, > + username: Proxmox.UserName, > password: ticket > }, > url: '/api2/json/access/ticket', > @@ -164,8 +164,8 @@ Ext.define('PVE.StdWorkspace', { > > var ui = me.query('#userinfo')[0]; > > - if (PVE.UserName) { > - var msg = Ext.String.format(gettext("You are logged in as {0}"), > "'" + PVE.UserName + "'"); > + if (Proxmox.UserName) { > + var msg = Ext.String.format(gettext("You are logged in as {0}"), > "'" + Proxmox.UserName + "'"); > ui.update('<div class="x-unselectable" > style="white-space:nowrap;">' + msg + '</div>'); > } else { > ui.update(''); > diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js > index 55514cdd..58482779 100644 > --- a/www/manager6/lxc/Resources.js > +++ b/www/manager6/lxc/Resources.js > @@ -197,7 +197,7 @@ Ext.define('PVE.lxc.RessourceView', { > var isDisk = (rowdef.tdCls == 'pve-itype-icon-storage'); > > var noedit = rec.data['delete'] || !rowdef.editor; > - if (!noedit && PVE.UserName !== 'root@pam' && key.match(/^mp\d+$/)) > { > + if (!noedit && Proxmox.UserName !== 'root@pam' && > key.match(/^mp\d+$/)) { > var mp = PVE.Parser.parseLxcMountPoint(value); > if (mp.type !== 'volume') { > noedit = true; > diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js > index 006d921c..bbda9842 100644 > --- a/www/manager6/node/Config.js > +++ b/www/manager6/node/Config.js > @@ -217,7 +217,7 @@ Ext.define('PVE.node.Config', { > xtype: 'proxmoxNodeAPT', > upgradeBtn: { > xtype: 'pveConsoleButton', > - disabled: PVE.UserName !== 'root@pam', > + disabled: Proxmox.UserName !== 'root@pam', > text: gettext('Upgrade'), > consoleType: 'upgrade', > nodename: nodename > diff --git a/www/mobile/Workspace.js b/www/mobile/Workspace.js > index f608ced6..765fb6d2 100644 > --- a/www/mobile/Workspace.js > +++ b/www/mobile/Workspace.js > @@ -107,8 +107,8 @@ Ext.define('PVE.Workspace', { statics: { > > updateLoginData: function(loginData) { > PVE.Workspace.loginData = loginData; > - PVE.CSRFPreventionToken = loginData.CSRFPreventionToken; > - PVE.UserName = loginData.username; > + Proxmox.CSRFPreventionToken = loginData.CSRFPreventionToken; > + Proxmox.UserName = loginData.username; > > // creates a session cookie (expire = null) > // that way the cookie gets deleted after browser window close > @@ -119,7 +119,7 @@ Ext.define('PVE.Workspace', { statics: { > > showLogin: function() { > Proxmox.Utils.authClear(); > - PVE.UserName = null; > + Proxmox.UserName = null; > PVE.Workspace.loginData = null; > > PVE.Workspace.gotoPage(''); > diff --git a/www/touch/index.html.tpl b/www/touch/index.html.tpl > index f5787b6d..33188fbc 100644 > --- a/www/touch/index.html.tpl > +++ b/www/touch/index.html.tpl > @@ -25,8 +25,6 @@ > <script type="text/javascript" > src="/pve2/touch/pvemanager-mobile.js?ver=[% version %]"></script> > <script type="text/javascript"> > if (typeof(PVE) === 'undefined') PVE = {}; > -PVE.UserName = '[% username %]' > -PVE.CSRFPreventionToken = '[% token %]'; > </script> > </head> > <body> > _______________________________________________ pve-devel mailing list [email protected] https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
