]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: re-new ticket every 15 minutes
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 17 Dec 2019 13:44:25 +0000 (14:44 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 17 Dec 2019 13:44:28 +0000 (14:44 +0100)
Like we do it in PVE/PMG

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/MainView.js

index e677f120c8d84b78e91ef36bb1c36be44649e5f5..b9e3450d6de9e8c0bfa79baa7eff654d4f7250db 100644 (file)
@@ -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
+           });
        }
     },