mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-08-06 02:17:31 +00:00
add helpers required for u2f authentication
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.bumiller@proxmox.com>
This commit is contained in:
parent
65bb3b678f
commit
c2e25a2111
15
Utils.js
15
Utils.js
@ -179,11 +179,26 @@ Ext.define('Proxmox.Utils', { utilities: {
|
|||||||
return min < width ? width : min;
|
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() {
|
authOK: function() {
|
||||||
|
if (Proxmox.LoggedOut) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
return (Proxmox.UserName !== '') && Ext.util.Cookies.get(Proxmox.Setup.auth_cookie_name);
|
return (Proxmox.UserName !== '') && Ext.util.Cookies.get(Proxmox.Setup.auth_cookie_name);
|
||||||
},
|
},
|
||||||
|
|
||||||
authClear: function() {
|
authClear: function() {
|
||||||
|
if (Proxmox.LoggedOut) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
Ext.util.Cookies.clear(Proxmox.Setup.auth_cookie_name);
|
Ext.util.Cookies.clear(Proxmox.Setup.auth_cookie_name);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user