With u2f having a ticket doesn't mean we're logged in yet,
so we need to be able to distinguish between the two.

Signed-off-by: Wolfgang Bumiller <w.bumil...@proxmox.com>
---
Forgot to send that one...
 Utils.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Utils.js b/Utils.js
index 9f98a11..f8cc1be 100644
--- a/Utils.js
+++ b/Utils.js
@@ -178,11 +178,26 @@ Ext.define('Proxmox.Utils', { utilities: {
        return min < width ? width : min;
     },
 
+    setAuthData: function(data) {
+       Proxmox.CSRFPreventionToken = data.CSRFPreventionToken;
+       Proxmox.UserName = data.username;
+       Proxmox.LoggedOut = data.LoggedOut;
+       // creates a session cookie (expire = null)
+       // that way the cookie gets deleted after the browser window is closed
+       Ext.util.Cookies.set(Proxmox.Setup.auth_cookie_name, data.ticket, null, 
'/', null, true);
+    },
+
     authOK: function() {
+       if (Proxmox.LoggedOut) {
+           return undefined;
+       }
        return (Proxmox.UserName !== '') && 
Ext.util.Cookies.get(Proxmox.Setup.auth_cookie_name);
     },
 
     authClear: function() {
+       if (Proxmox.LoggedOut) {
+           return undefined;
+       }
        Ext.util.Cookies.clear(Proxmox.Setup.auth_cookie_name);
     },
 
-- 
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to