ui: re-new ticket every 15 minutes

Like we do it in PVE/PMG

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-12-17 14:44:25 +01:00
parent 6cc8abbbd5
commit a602faeb98

View File

@ -100,6 +100,33 @@ Ext.define('PBS.MainView', {
var me = this; var me = this;
me.lookupReference('usernameinfo').update({username:Proxmox.UserName}); me.lookupReference('usernameinfo').update({username:Proxmox.UserName});
// get ticket periodically
Ext.TaskManager.start({
run: function() {
var ticket = Proxmox.Utils.authOK();
if (!ticket || !Proxmox.UserName) {
return;
}
Ext.Ajax.request({
params: {
username: Proxmox.UserName,
password: ticket
},
url: '/api2/json/access/ticket',
method: 'POST',
failure: function() {
me.logout();
},
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
PMG.Utils.updateLoginData(obj.data);
}
});
},
interval: 15*60*1000
});
} }
}, },