<script type="text/javascript">
if (typeof(PVE) === 'undefined') PVE = {};
- PVE.UserName = '[% username %]'
- PVE.CSRFPreventionToken = '[% token %]';
Ext.History.fieldid = 'x-history-field';
Ext.onReady(function() { Ext.create('PVE.StdWorkspace');});
</script>
'Accept': 'application/json'
};
-Ext.Ajax.on('beforerequest', function(conn, options) {
- if (PVE.CSRFPreventionToken) {
- if (!options.headers) {
- options.headers = {};
- }
- options.headers.CSRFPreventionToken = PVE.CSRFPreventionToken;
- }
-});
-
Ext.define('PVE.Utils', { utilities: {
// this singleton contains miscellaneous utilities
updateLoginData: function(loginData) {
var me = this;
me.loginData = loginData;
- PVE.CSRFPreventionToken = loginData.CSRFPreventionToken;
- PVE.UserName = loginData.username;
+ Proxmox.CSRFPreventionToken = loginData.CSRFPreventionToken;
+ Proxmox.UserName = loginData.username;
if (loginData.cap) {
Ext.state.Manager.set('GuiCap', loginData.cap);
var me = this;
Proxmox.Utils.authClear();
- PVE.UserName = null;
+ Proxmox.UserName = null;
me.loginData = null;
if (!me.login) {
Ext.TaskManager.start({
run: function() {
var ticket = Proxmox.Utils.authOK();
- if (!ticket || !PVE.UserName) {
+ if (!ticket || !Proxmox.UserName) {
return;
}
Ext.Ajax.request({
params: {
- username: PVE.UserName,
+ username: Proxmox.UserName,
password: ticket
},
url: '/api2/json/access/ticket',
var ui = me.query('#userinfo')[0];
- if (PVE.UserName) {
- var msg = Ext.String.format(gettext("You are logged in as {0}"), "'" + PVE.UserName + "'");
+ if (Proxmox.UserName) {
+ var msg = Ext.String.format(gettext("You are logged in as {0}"), "'" + Proxmox.UserName + "'");
ui.update('<div class="x-unselectable" style="white-space:nowrap;">' + msg + '</div>');
} else {
ui.update('');
var isDisk = (rowdef.tdCls == 'pve-itype-icon-storage');
var noedit = rec.data['delete'] || !rowdef.editor;
- if (!noedit && PVE.UserName !== 'root@pam' && key.match(/^mp\d+$/)) {
+ if (!noedit && Proxmox.UserName !== 'root@pam' && key.match(/^mp\d+$/)) {
var mp = PVE.Parser.parseLxcMountPoint(value);
if (mp.type !== 'volume') {
noedit = true;
xtype: 'proxmoxNodeAPT',
upgradeBtn: {
xtype: 'pveConsoleButton',
- disabled: PVE.UserName !== 'root@pam',
+ disabled: Proxmox.UserName !== 'root@pam',
text: gettext('Upgrade'),
consoleType: 'upgrade',
nodename: nodename
updateLoginData: function(loginData) {
PVE.Workspace.loginData = loginData;
- PVE.CSRFPreventionToken = loginData.CSRFPreventionToken;
- PVE.UserName = loginData.username;
+ Proxmox.CSRFPreventionToken = loginData.CSRFPreventionToken;
+ Proxmox.UserName = loginData.username;
// creates a session cookie (expire = null)
// that way the cookie gets deleted after browser window close
showLogin: function() {
Proxmox.Utils.authClear();
- PVE.UserName = null;
+ Proxmox.UserName = null;
PVE.Workspace.loginData = null;
PVE.Workspace.gotoPage('');
<script type="text/javascript" src="/pve2/touch/pvemanager-mobile.js?ver=[% version %]"></script>
<script type="text/javascript">
if (typeof(PVE) === 'undefined') PVE = {};
-PVE.UserName = '[% username %]'
-PVE.CSRFPreventionToken = '[% token %]';
</script>
</head>
<body>