From a602faeb98942fb21d48f47363e0292bef01320d Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 17 Dec 2019 14:44:25 +0100 Subject: [PATCH] ui: re-new ticket every 15 minutes Like we do it in PVE/PMG Signed-off-by: Thomas Lamprecht --- www/MainView.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/www/MainView.js b/www/MainView.js index e677f120..b9e3450d 100644 --- a/www/MainView.js +++ b/www/MainView.js @@ -100,6 +100,33 @@ Ext.define('PBS.MainView', { var me = this; 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 + }); } },