Server fixes, added locale arg in web app.
This commit is contained in:
parent
efa3f6e5cf
commit
67feb1422f
4
db.js
4
db.js
|
@ -877,7 +877,9 @@ module.exports.CreateDB = function (parent, func) {
|
||||||
for (var i in muser) { if (user[i] == null) { delete muser[i]; } }
|
for (var i in muser) { if (user[i] == null) { delete muser[i]; } }
|
||||||
|
|
||||||
// Send the user update
|
// Send the user update
|
||||||
parent.DispatchEvent(['*', 'server-users', user._id], obj, { etype: 'user', username: user.name, account: parent.webserver.CloneSafeUser(user), action: (added ? 'accountcreate' : 'accountchange'), domain: user.domain, nolog: 1 });
|
var targets = ['*', 'server-users', user._id];
|
||||||
|
if (user.groups) { for (var i in user.groups) { targets.push('server-users:' + i); } }
|
||||||
|
parent.DispatchEvent(targets, obj, { etype: 'user', username: user.name, account: parent.webserver.CloneSafeUser(user), action: (added ? 'accountcreate' : 'accountchange'), domain: user.domain, nolog: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
|
@ -28,6 +28,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
const MESHRIGHT_SERVERFILES = 32;
|
const MESHRIGHT_SERVERFILES = 32;
|
||||||
const MESHRIGHT_WAKEDEVICE = 64;
|
const MESHRIGHT_WAKEDEVICE = 64;
|
||||||
const MESHRIGHT_SETNOTES = 128;
|
const MESHRIGHT_SETNOTES = 128;
|
||||||
|
const MESHRIGHT_REMOTEVIEWONLY = 256;
|
||||||
|
const MESHRIGHT_NOTERMINAL = 512;
|
||||||
|
const MESHRIGHT_NOFILES = 1024;
|
||||||
|
const MESHRIGHT_NOAMT = 2048;
|
||||||
|
const MESHRIGHT_DESKLIMITEDINPUT = 4096;
|
||||||
|
|
||||||
// Site rights
|
// Site rights
|
||||||
const SITERIGHT_SERVERBACKUP = 1;
|
const SITERIGHT_SERVERBACKUP = 1;
|
||||||
|
@ -36,6 +41,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
const SITERIGHT_FILEACCESS = 8;
|
const SITERIGHT_FILEACCESS = 8;
|
||||||
const SITERIGHT_SERVERUPDATE = 16;
|
const SITERIGHT_SERVERUPDATE = 16;
|
||||||
const SITERIGHT_LOCKED = 32;
|
const SITERIGHT_LOCKED = 32;
|
||||||
|
const SITERIGHT_NONEWGROUPS = 64;
|
||||||
|
const SITERIGHT_NOMESHCMD = 128;
|
||||||
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj.user = user;
|
obj.user = user;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.3.6-i",
|
"version": "0.3.6-j",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
|
|
||||||
<div id="macostab" class="tabcontent" style="background-color:white;color:black">
|
<div id="macostab" class="tabcontent" style="background-color:white;color:black">
|
||||||
<h3>Apple™ MacOS</h3>
|
<h3>Apple™ MacOS</h3>
|
||||||
<p><a id="macosurl">Download the installer here</a>, right click on it and select "Open", then follow the instructions.</p>
|
<p><a id="macosurl">Download the installer here</a>, right click on it or press "control" and click on the file. Then select "Open" and follow the instructions.</p>
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<img src="images/macosagent.png" />
|
<img src="images/macosagent.png" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7437,7 +7437,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
node.lastconnect = message.time;
|
node.lastconnect = message.time;
|
||||||
node.lastaddr = message.addr;
|
node.lastaddr = message.addr;
|
||||||
if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
|
if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
|
||||||
QH('MainComputerState', '<span>Last seen:<br />' + new Date(node.lastconnect).toLocaleDateString() + ', ' + new Date(node.lastconnect).toLocaleTimeString() + '</span>');
|
QH('MainComputerState', '<span>Last seen:<br />' + printDateTime(new Date(node.lastconnect)) + '</span>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -7483,7 +7483,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
} else {
|
} else {
|
||||||
var x = '<div class=dialogText>';
|
var x = '<div class=dialogText>';
|
||||||
|
|
||||||
if (currentNode.lastconnect) { x += addHtmlValue2('Last agent connection', new Date(currentNode.lastconnect).toLocaleString()); }
|
if (currentNode.lastconnect) { x += addHtmlValue2('Last agent connection', printDateTime(new Date(currentNode.lastconnect))); }
|
||||||
if (currentNode.lastaddr) {
|
if (currentNode.lastaddr) {
|
||||||
var splitip = currentNode.lastaddr.split(':');
|
var splitip = currentNode.lastaddr.split(':');
|
||||||
if (splitip.length > 2) {
|
if (splitip.length > 2) {
|
||||||
|
@ -7499,7 +7499,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x += addHtmlValue2('Last interfaces update', new Date(message.updateTime).toLocaleString());
|
x += addHtmlValue2('Last interfaces update', printDateTime(new Date(message.updateTime)));
|
||||||
for (var i in message.netif) {
|
for (var i in message.netif) {
|
||||||
var net = message.netif[i];
|
var net = message.netif[i];
|
||||||
x += '<hr />'
|
x += '<hr />'
|
||||||
|
@ -7577,7 +7577,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
var n = Q('d2devNotes');
|
var n = Q('d2devNotes');
|
||||||
if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
|
if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
|
||||||
if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
|
if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
|
||||||
var ro = n.attributes['ro'].value == 'true';
|
var ro = (n.attributes['ro'].value == 'true');
|
||||||
if (ro == false) { // If we have permissions, set read/write on this note.
|
if (ro == false) { // If we have permissions, set read/write on this note.
|
||||||
n.removeAttribute('readonly');
|
n.removeAttribute('readonly');
|
||||||
QE('idx_dlgOkButton', true);
|
QE('idx_dlgOkButton', true);
|
||||||
|
@ -9982,7 +9982,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Agent connected">Agent connected</span>'; }
|
if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Agent connected">Agent connected</span>'; }
|
||||||
if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'; }
|
if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'; }
|
||||||
else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT detected">Intel® AMT detected</span>'; }
|
else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT detected">Intel® AMT detected</span>'; }
|
||||||
if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>Last seen:<br />' + new Date(node.lastconnect).toLocaleDateString() + ', ' + new Date(node.lastconnect).toLocaleTimeString() + '</span>'; }
|
if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>Last seen:<br />' + printDateTime(new Date(node.lastconnect)) + '</span>'; }
|
||||||
QH('MainComputerState', powerstate);
|
QH('MainComputerState', powerstate);
|
||||||
|
|
||||||
// Set the node icon
|
// Set the node icon
|
||||||
|
@ -10166,12 +10166,12 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
var te = Math.min(Math.min(end, block[1]), now);
|
var te = Math.min(Math.min(end, block[1]), now);
|
||||||
var width = Math.round(((te - ts) * totalWidth) / 86400000);
|
var width = Math.round(((te - ts) * totalWidth) / 86400000);
|
||||||
if (width > 0) {
|
if (width > 0) {
|
||||||
var title = powerStateStrings2[block[2]] + ' from ' + new Date(ts).toLocaleTimeString() + ' to ' + new Date(te).toLocaleTimeString() + '.';
|
var title = powerStateStrings2[block[2]] + ' from ' + printTime(new Date(ts)) + ' to ' + printTime(new Date(te)) + '.';
|
||||||
datavalue += '<div class="pwState ' + powerColor(block[2]) + '" title="' + title + '" style="width:' + width + 'px;"></div>';
|
datavalue += '<div class="pwState ' + powerColor(block[2]) + '" title="' + title + '" style="width:' + width + 'px;"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += '<tr class=' + (((count % 2) == 0)?'altBack':'') + '><td><div> ' + date.toLocaleDateString() + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
x += '<tr class=' + (((count % 2) == 0)?'altBack':'') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
||||||
++count;
|
++count;
|
||||||
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
||||||
}
|
}
|
||||||
|
@ -11354,7 +11354,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
|
|
||||||
// Figure out the date
|
// Figure out the date
|
||||||
var fdatestr = '';
|
var fdatestr = '';
|
||||||
if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
|
if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + " "; }
|
||||||
|
|
||||||
// Figure out the size
|
// Figure out the size
|
||||||
var fsize = '';
|
var fsize = '';
|
||||||
|
@ -11703,10 +11703,10 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
for (var i in currentDeviceEvents) {
|
for (var i in currentDeviceEvents) {
|
||||||
var event = currentDeviceEvents[i];
|
var event = currentDeviceEvents[i];
|
||||||
var time = new Date(event.time);
|
var time = new Date(event.time);
|
||||||
if (time.toLocaleDateString() != dateHeader) {
|
if (printDate(time) != dateHeader) {
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt colspan=4>' + time.toLocaleDateString() + '</td></tr>';
|
dateHeader = printDate(time);
|
||||||
dateHeader = time.toLocaleDateString();
|
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt colspan=4>' + dateHeader + '</td></tr>';
|
||||||
}
|
}
|
||||||
var icon = 'si3';
|
var icon = 'si3';
|
||||||
if (event.etype == 'user') icon = 'm2';
|
if (event.etype == 'user') icon = 'm2';
|
||||||
|
@ -11714,7 +11714,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
|
|
||||||
var msg = event.msg.split('(R)').join('®');
|
var msg = event.msg.split('(R)').join('®');
|
||||||
//if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
//if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
||||||
x += '<tr><td style=width:18px><div class=' + icon + '></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>' + time.toLocaleTimeString() + ' - ' + msg + '</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>';
|
x += '<tr><td style=width:18px><div class=' + icon + '></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>' + printTime(time) + ' - ' + msg + '</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>';
|
||||||
}
|
}
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
||||||
|
@ -12699,7 +12699,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
|
|
||||||
// Figure out the date
|
// Figure out the date
|
||||||
var fdatestr = '';
|
var fdatestr = '';
|
||||||
if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
|
if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + " "; }
|
||||||
|
|
||||||
// Figure out the size
|
// Figure out the size
|
||||||
var fsize = '';
|
var fsize = '';
|
||||||
|
@ -12910,10 +12910,10 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
for (var i in events) {
|
for (var i in events) {
|
||||||
var event = events[i], time = new Date(event.time);
|
var event = events[i], time = new Date(event.time);
|
||||||
if (event.msg) {
|
if (event.msg) {
|
||||||
if (time.toLocaleDateString() != dateHeader) {
|
if (printDate(time) != dateHeader) {
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
x += '<table class=p3eventsTable cellpadding=0 cellspacing=0><tr><td colspan=4 class=DevSt>' + time.toLocaleDateString() + '</td></tr>';
|
dateHeader = printDate(time);
|
||||||
dateHeader = time.toLocaleDateString();
|
x += '<table class=p3eventsTable cellpadding=0 cellspacing=0><tr><td colspan=4 class=DevSt>' + dateHeader + '</td></tr>';
|
||||||
}
|
}
|
||||||
var icon = 'si3';
|
var icon = 'si3';
|
||||||
if (event.etype == 'user') icon = 'm2';
|
if (event.etype == 'user') icon = 'm2';
|
||||||
|
@ -12921,7 +12921,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
|
|
||||||
var msg = event.msg.split('(R)').join('®');
|
var msg = event.msg.split('(R)').join('®');
|
||||||
if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
||||||
x += '<tr onmouseover=eventMouseHover(this,1) onmouseout=eventMouseHover(this,0) style=cursor:pointer><td style=width:18px><div class=' + icon + '></div></td><td class=g1> </td><td class=style10>' + time.toLocaleTimeString() + ' - ' + msg + '</td><td class=g2> </td></tr><tr style=height:2px></tr>';
|
x += '<tr onmouseover=eventMouseHover(this,1) onmouseout=eventMouseHover(this,0) style=cursor:pointer><td style=width:18px><div class=' + icon + '></div></td><td class=g1> </td><td class=style10>' + printTime(time) + ' - ' + msg + '</td><td class=g2> </td></tr><tr style=height:2px></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
|
@ -13051,17 +13051,21 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
}
|
}
|
||||||
if (sessions == 1) { lastAccess += '1 session'; } else { lastAccess += sessions + ' sessions'; }
|
if (sessions == 1) { lastAccess += '1 session'; } else { lastAccess += sessions + ' sessions'; }
|
||||||
} else {
|
} else {
|
||||||
if (user.login) { lastAccess += '<span title="Last login: ' + new Date(user.login * 1000).toLocaleString() + '">' + new Date(user.login * 1000).toLocaleDateString() + '</span>'; }
|
if (user.login) { lastAccess += '<span title="Last login: ' + printDateTime(new Date(user.login * 1000)) + '">' + printDate(new Date(user.login * 1000)) + '</span>'; }
|
||||||
}
|
}
|
||||||
if (self) { permissions += "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + encodeURIComponent(user._id) + "\")>"; }
|
if (self) { permissions += "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + encodeURIComponent(user._id) + "\")>"; }
|
||||||
if ((user.siteadmin != null) && ((user.siteadmin & 32) != 0) && (user.siteadmin != 0xFFFFFFFF)) { permissions += "Locked, "; }
|
if ((user.siteadmin != null) && ((user.siteadmin & 32) != 0) && (user.siteadmin != 0xFFFFFFFF)) { permissions += "Locked, "; }
|
||||||
permissions += "<span title='Server Permissions'>";
|
permissions += "<span title='Server Permissions'>";
|
||||||
if ((user.siteadmin == null) || (user.siteadmin == 0) || ((user.siteadmin & (0xFFFFFFFF - 224)) == 0)) {
|
|
||||||
|
var urights = user.siteadmin & (0xFFFFFFFF - 224);
|
||||||
|
if ((user.siteadmin == null) || (urights == 0)) {
|
||||||
permissions += "User";
|
permissions += "User";
|
||||||
} else if (user.siteadmin == 8) {
|
} else if (urights == 8) {
|
||||||
permissions += "User + Files";
|
permissions += "User + Files";
|
||||||
} else if (user.siteadmin == 0xFFFFFFFF) {
|
} else if (user.siteadmin == 0xFFFFFFFF) {
|
||||||
permissions += "Administrator";
|
permissions += "Administrator";
|
||||||
|
} else if ((urights & 2) != 0) {
|
||||||
|
permissions += "Manager";
|
||||||
} else {
|
} else {
|
||||||
permissions += "Partial";
|
permissions += "Partial";
|
||||||
}
|
}
|
||||||
|
@ -13256,14 +13260,14 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
if (xxdialogMode) return;
|
if (xxdialogMode) return;
|
||||||
haltEvent(e);
|
haltEvent(e);
|
||||||
userid = decodeURIComponent(userid);
|
userid = decodeURIComponent(userid);
|
||||||
var x = '<div>';
|
var x = '<div><div id=d2AdminPermissions>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 id=ua_fileaccessquota>k max, blank for default<br><hr/>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 id=ua_fileaccessquota>k max, blank for default<br><hr/>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>';
|
||||||
x += '<hr/><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>';
|
x += '<hr/></div><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nonewgroups>No New Device Groups<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nonewgroups>No New Device Groups<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nomeshcmd>No Tools (MeshCmd/Router)<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nomeshcmd>No Tools (MeshCmd/Router)<br>';
|
||||||
x += '</div>';
|
x += '</div>';
|
||||||
|
@ -13287,6 +13291,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
QE('ua_fileaccess', userinfo.siteadmin == 0xFFFFFFFF);
|
QE('ua_fileaccess', userinfo.siteadmin == 0xFFFFFFFF);
|
||||||
QE('ua_fileaccessquota', userinfo.siteadmin == 0xFFFFFFFF);
|
QE('ua_fileaccessquota', userinfo.siteadmin == 0xFFFFFFFF);
|
||||||
QE('ua_serverupdate', userinfo.siteadmin == 0xFFFFFFFF);
|
QE('ua_serverupdate', userinfo.siteadmin == 0xFFFFFFFF);
|
||||||
|
QV('d2AdminPermissions', userinfo.siteadmin == 0xFFFFFFFF)
|
||||||
QE('ua_lockedaccount', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
QE('ua_lockedaccount', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
||||||
QE('ua_nonewgroups', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
QE('ua_nonewgroups', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
||||||
QE('ua_nomeshcmd', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
QE('ua_nomeshcmd', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
||||||
|
@ -13364,10 +13369,10 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
}
|
}
|
||||||
x += addDeviceAttribute('Server Rights', premsg + "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + userid + "\")>" + msg.join(', ') + "</a>");
|
x += addDeviceAttribute('Server Rights', premsg + "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + userid + "\")>" + msg.join(', ') + "</a>");
|
||||||
if (user.quota) x += addDeviceAttribute('Server Quota', EscapeHtml(parseInt(user.quota) / 1024) + ' k');
|
if (user.quota) x += addDeviceAttribute('Server Quota', EscapeHtml(parseInt(user.quota) / 1024) + ' k');
|
||||||
x += addDeviceAttribute('Creation', new Date(user.creation * 1000).toLocaleString());
|
x += addDeviceAttribute('Creation', printDateTime(new Date(user.creation * 1000)));
|
||||||
if (user.login) x += addDeviceAttribute('Last Login', new Date(user.login * 1000).toLocaleString());
|
if (user.login) x += addDeviceAttribute('Last Login', printDateTime(new Date(user.login * 1000)));
|
||||||
if (user.passchange == -1) { x += addDeviceAttribute('Password', 'Will be changed on next login.'); }
|
if (user.passchange == -1) { x += addDeviceAttribute('Password', 'Will be changed on next login.'); }
|
||||||
else if (user.passchange) { x += addDeviceAttribute('Password', 'Last changed: ' + new Date(user.passchange * 1000).toLocaleString()); }
|
else if (user.passchange) { x += addDeviceAttribute('Password', 'Last changed: ' + printDateTime(new Date(user.passchange * 1000))); }
|
||||||
|
|
||||||
// Device Groups
|
// Device Groups
|
||||||
var linkCount = 0, linkCountStr = '<i>None<i>';
|
var linkCount = 0, linkCountStr = '<i>None<i>';
|
||||||
|
@ -13544,12 +13549,12 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
var te = Math.min(Math.min(end, block[1]), now);
|
var te = Math.min(Math.min(end, block[1]), now);
|
||||||
var width = Math.round((te - ts) / 112794);
|
var width = Math.round((te - ts) / 112794);
|
||||||
if (width > 0) {
|
if (width > 0) {
|
||||||
var title = powerStateStrings2[block[2]] + ' from ' + new Date(ts).toLocaleTimeString() + ' to ' + new Date(te).toLocaleTimeString() + '.';
|
var title = powerStateStrings2[block[2]] + ' from ' + printTime(new Date(ts)) + ' to ' + printTime(new Date(te)) + '.';
|
||||||
datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
|
datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += '<tr style=' + (((count % 2) == 0)?'background-color:#DDD':'') + '><td><div> ' + date.toLocaleDateString() + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
x += '<tr style=' + (((count % 2) == 0)?'background-color:#DDD':'') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
||||||
++count;
|
++count;
|
||||||
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
||||||
}
|
}
|
||||||
|
@ -13566,10 +13571,10 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
for (var i in currentUserEvents) {
|
for (var i in currentUserEvents) {
|
||||||
var event = currentUserEvents[i];
|
var event = currentUserEvents[i];
|
||||||
var time = new Date(event.time);
|
var time = new Date(event.time);
|
||||||
if (time.toLocaleDateString() != dateHeader) {
|
if (printDate(time) != dateHeader) {
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>' + time.toLocaleDateString() + '</td></tr>';
|
dateHeader = printDate(time);
|
||||||
dateHeader = time.toLocaleDateString();
|
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>' + dateHeader + '</td></tr>';
|
||||||
}
|
}
|
||||||
var icon = 'si3';
|
var icon = 'si3';
|
||||||
if (event.etype == 'user') icon = 'm2';
|
if (event.etype == 'user') icon = 'm2';
|
||||||
|
@ -13580,7 +13585,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
x += '<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>';
|
x += '<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>';
|
||||||
x += '<div style=float:left;height:18px;width:18px;background-color:white><div class=' + icon + ' style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
|
x += '<div style=float:left;height:18px;width:18px;background-color:white><div class=' + icon + ' style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
|
||||||
x += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
|
x += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
|
||||||
x += '<div style=font-size:14px><span style=width:300px>' + time.toLocaleTimeString() + ' - ' + msg + '</span></div></div></td></tr>';
|
x += '<div style=font-size:14px><span style=width:300px>' + printTime(time) + ' - ' + msg + '</span></div></div></td></tr>';
|
||||||
}
|
}
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
||||||
|
@ -13720,7 +13725,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' }
|
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' }
|
||||||
}
|
}
|
||||||
|
|
||||||
r += '<div title="Occured at ' + d.toLocaleString() + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
|
r += '<div title="Occured at ' + printDateTime(d) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
|
||||||
if (icon) { r += '<div class=j' + icon + ' onclick="notificationSelected(' + n.id + ')" style=margin:5px;float:left></div>'; }
|
if (icon) { r += '<div class=j' + icon + ' onclick="notificationSelected(' + n.id + ')" style=margin:5px;float:left></div>'; }
|
||||||
r += '<div onclick="notificationDelete(' + n.id + ')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected(' + n.id + ')" style=margin:5px>' + t + n.text + '</div></div>';
|
r += '<div onclick="notificationDelete(' + n.id + ')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected(' + n.id + ')" style=margin:5px>' + t + n.text + '</div></div>';
|
||||||
}
|
}
|
||||||
|
@ -14183,5 +14188,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
||||||
function u2fSupported() { return (window.u2f && ((navigator.userAgent.indexOf('Chrome/') > 0) || (navigator.userAgent.indexOf('Firefox/') > 0) || (navigator.userAgent.indexOf('Opera/') > 0) || (navigator.userAgent.indexOf('Safari/') > 0))); }
|
function u2fSupported() { return (window.u2f && ((navigator.userAgent.indexOf('Chrome/') > 0) || (navigator.userAgent.indexOf('Firefox/') > 0) || (navigator.userAgent.indexOf('Opera/') > 0) || (navigator.userAgent.indexOf('Safari/') > 0))); }
|
||||||
function findOne(arr1, arr2) { if ((arr1 == null) || (arr2 == null)) return false; return arr2.some(function (v) { return arr1.indexOf(v) >= 0; }); };
|
function findOne(arr1, arr2) { if ((arr1 == null) || (arr2 == null)) return false; return arr2.some(function (v) { return arr1.indexOf(v) >= 0; }); };
|
||||||
function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
|
function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
|
||||||
|
function printDate(d) { return d.toLocaleDateString(args.locale); }
|
||||||
|
function printTime(d) { return d.toLocaleTimeString(args.locale); }
|
||||||
|
function printDateTime(d) { return d.toLocaleString(args.locale); }
|
||||||
</script></body></html>
|
</script></body></html>
|
File diff suppressed because one or more lines are too long
|
@ -571,6 +571,7 @@
|
||||||
<iframe name="fileUploadFrame" style=display:none></iframe>
|
<iframe name="fileUploadFrame" style=display:none></iframe>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var args = parseUriArgs();
|
||||||
var debugLevel = parseInt('{{{debuglevel}}}');
|
var debugLevel = parseInt('{{{debuglevel}}}');
|
||||||
var features = parseInt('{{{features}}}');
|
var features = parseInt('{{{features}}}');
|
||||||
var sessionTime = parseInt("{{{sessiontime}}}");
|
var sessionTime = parseInt("{{{sessiontime}}}");
|
||||||
|
@ -1361,7 +1362,7 @@
|
||||||
|
|
||||||
// Figure out the date
|
// Figure out the date
|
||||||
//var fdatestr = '';
|
//var fdatestr = '';
|
||||||
//if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
|
//if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + printTime(fdate) + " "; }
|
||||||
|
|
||||||
// Figure out the size
|
// Figure out the size
|
||||||
var fsize = '';
|
var fsize = '';
|
||||||
|
@ -1973,12 +1974,12 @@
|
||||||
var te = Math.min(Math.min(end, block[1]), now);
|
var te = Math.min(Math.min(end, block[1]), now);
|
||||||
var width = Math.round(((te - ts) * totalWidth) / 86400000);
|
var width = Math.round(((te - ts) * totalWidth) / 86400000);
|
||||||
if (width > 0) {
|
if (width > 0) {
|
||||||
var title = powerStateStrings2[block[2]] + ' from ' + new Date(ts).toLocaleTimeString() + ' to ' + new Date(te).toLocaleTimeString() + '.';
|
var title = powerStateStrings2[block[2]] + ' from ' + printTime(new Date(ts)) + ' to ' + printTime(new Date(te)) + '.';
|
||||||
datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
|
datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += '<tr style=' + (((count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><div> ' + date.toLocaleDateString() + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
x += '<tr style=' + (((count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
||||||
++count;
|
++count;
|
||||||
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
||||||
}
|
}
|
||||||
|
@ -3145,6 +3146,10 @@
|
||||||
function joinPaths() { var x = []; for (var i in arguments) { var w = arguments[i]; if ((w != null) && (w != '')) { while (w.endsWith('/') || w.endsWith('\\')) { w = w.substring(0, w.length - 1); } while (w.startsWith('/') || w.startsWith('\\')) { w = w.substring(1); } x.push(w); } } return x.join('/'); }
|
function joinPaths() { var x = []; for (var i in arguments) { var w = arguments[i]; if ((w != null) && (w != '')) { while (w.endsWith('/') || w.endsWith('\\')) { w = w.substring(0, w.length - 1); } while (w.startsWith('/') || w.startsWith('\\')) { w = w.substring(1); } x.push(w); } } return x.join('/'); }
|
||||||
function focusTextBox(x) { setTimeout(function () { Q(x).selectionStart = Q(x).selectionEnd = 65535; Q(x).focus(); }, 0); }
|
function focusTextBox(x) { setTimeout(function () { Q(x).selectionStart = Q(x).selectionEnd = 65535; Q(x).focus(); }, 0); }
|
||||||
var isFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); } })();
|
var isFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); } })();
|
||||||
|
function parseUriArgs() { var name, r = {}, parsedUri = window.document.location.href.split(/[\?&|\=]/); parsedUri.splice(0, 1); for (x in parsedUri) { switch (x % 2) { case 0: { name = decodeURIComponent(parsedUri[x]); break; } case 1: { r[name] = decodeURIComponent(parsedUri[x]); var x = parseInt(r[name]); if (x == r[name]) { r[name] = x; } break; } default: { break; } } } return r; }
|
||||||
|
function printDate(d) { return d.toLocaleDateString(args.locale); }
|
||||||
|
function printTime(d) { return d.toLocaleTimeString(args.locale); }
|
||||||
|
function printDateTime(d) { return d.toLocaleString(args.locale); }
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1389,7 +1389,7 @@
|
||||||
node.lastconnect = message.time;
|
node.lastconnect = message.time;
|
||||||
node.lastaddr = message.addr;
|
node.lastaddr = message.addr;
|
||||||
if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
|
if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) {
|
||||||
QH('MainComputerState', '<span>Last seen:<br />' + new Date(node.lastconnect).toLocaleDateString() + ', ' + new Date(node.lastconnect).toLocaleTimeString() + '</span>');
|
QH('MainComputerState', '<span>Last seen:<br />' + printDateTime(new Date(node.lastconnect)) + '</span>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1435,7 +1435,7 @@
|
||||||
} else {
|
} else {
|
||||||
var x = '<div class=dialogText>';
|
var x = '<div class=dialogText>';
|
||||||
|
|
||||||
if (currentNode.lastconnect) { x += addHtmlValue2('Last agent connection', new Date(currentNode.lastconnect).toLocaleString()); }
|
if (currentNode.lastconnect) { x += addHtmlValue2('Last agent connection', printDateTime(new Date(currentNode.lastconnect))); }
|
||||||
if (currentNode.lastaddr) {
|
if (currentNode.lastaddr) {
|
||||||
var splitip = currentNode.lastaddr.split(':');
|
var splitip = currentNode.lastaddr.split(':');
|
||||||
if (splitip.length > 2) {
|
if (splitip.length > 2) {
|
||||||
|
@ -1451,7 +1451,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x += addHtmlValue2('Last interfaces update', new Date(message.updateTime).toLocaleString());
|
x += addHtmlValue2('Last interfaces update', printDateTime(new Date(message.updateTime)));
|
||||||
for (var i in message.netif) {
|
for (var i in message.netif) {
|
||||||
var net = message.netif[i];
|
var net = message.netif[i];
|
||||||
x += '<hr />'
|
x += '<hr />'
|
||||||
|
@ -1529,7 +1529,7 @@
|
||||||
var n = Q('d2devNotes');
|
var n = Q('d2devNotes');
|
||||||
if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
|
if (n && (message.id == decodeURIComponent(n.attributes['noteid'].value))) {
|
||||||
if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
|
if (message.notes) { QH('d2devNotes', decodeURIComponent(message.notes)); } else { QH('d2devNotes', ''); }
|
||||||
var ro = n.attributes['ro'].value == 'true';
|
var ro = (n.attributes['ro'].value == 'true');
|
||||||
if (ro == false) { // If we have permissions, set read/write on this note.
|
if (ro == false) { // If we have permissions, set read/write on this note.
|
||||||
n.removeAttribute('readonly');
|
n.removeAttribute('readonly');
|
||||||
QE('idx_dlgOkButton', true);
|
QE('idx_dlgOkButton', true);
|
||||||
|
@ -3934,7 +3934,7 @@
|
||||||
if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Agent connected">Agent connected</span>'; }
|
if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Agent connected">Agent connected</span>'; }
|
||||||
if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'; }
|
if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'; }
|
||||||
else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT detected">Intel® AMT detected</span>'; }
|
else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT detected">Intel® AMT detected</span>'; }
|
||||||
if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>Last seen:<br />' + new Date(node.lastconnect).toLocaleDateString() + ', ' + new Date(node.lastconnect).toLocaleTimeString() + '</span>'; }
|
if ((powerstate == '') && node.lastconnect) { powerstate = '<span style=font-size:12px>Last seen:<br />' + printDateTime(new Date(node.lastconnect)) + '</span>'; }
|
||||||
QH('MainComputerState', powerstate);
|
QH('MainComputerState', powerstate);
|
||||||
|
|
||||||
// Set the node icon
|
// Set the node icon
|
||||||
|
@ -4118,12 +4118,12 @@
|
||||||
var te = Math.min(Math.min(end, block[1]), now);
|
var te = Math.min(Math.min(end, block[1]), now);
|
||||||
var width = Math.round(((te - ts) * totalWidth) / 86400000);
|
var width = Math.round(((te - ts) * totalWidth) / 86400000);
|
||||||
if (width > 0) {
|
if (width > 0) {
|
||||||
var title = powerStateStrings2[block[2]] + ' from ' + new Date(ts).toLocaleTimeString() + ' to ' + new Date(te).toLocaleTimeString() + '.';
|
var title = powerStateStrings2[block[2]] + ' from ' + printTime(new Date(ts)) + ' to ' + printTime(new Date(te)) + '.';
|
||||||
datavalue += '<div class="pwState ' + powerColor(block[2]) + '" title="' + title + '" style="width:' + width + 'px;"></div>';
|
datavalue += '<div class="pwState ' + powerColor(block[2]) + '" title="' + title + '" style="width:' + width + 'px;"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += '<tr class=' + (((count % 2) == 0)?'altBack':'') + '><td><div> ' + date.toLocaleDateString() + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
x += '<tr class=' + (((count % 2) == 0)?'altBack':'') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
||||||
++count;
|
++count;
|
||||||
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
||||||
}
|
}
|
||||||
|
@ -5306,7 +5306,7 @@
|
||||||
|
|
||||||
// Figure out the date
|
// Figure out the date
|
||||||
var fdatestr = '';
|
var fdatestr = '';
|
||||||
if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
|
if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + " "; }
|
||||||
|
|
||||||
// Figure out the size
|
// Figure out the size
|
||||||
var fsize = '';
|
var fsize = '';
|
||||||
|
@ -5655,10 +5655,10 @@
|
||||||
for (var i in currentDeviceEvents) {
|
for (var i in currentDeviceEvents) {
|
||||||
var event = currentDeviceEvents[i];
|
var event = currentDeviceEvents[i];
|
||||||
var time = new Date(event.time);
|
var time = new Date(event.time);
|
||||||
if (time.toLocaleDateString() != dateHeader) {
|
if (printDate(time) != dateHeader) {
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt colspan=4>' + time.toLocaleDateString() + '</td></tr>';
|
dateHeader = printDate(time);
|
||||||
dateHeader = time.toLocaleDateString();
|
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt colspan=4>' + dateHeader + '</td></tr>';
|
||||||
}
|
}
|
||||||
var icon = 'si3';
|
var icon = 'si3';
|
||||||
if (event.etype == 'user') icon = 'm2';
|
if (event.etype == 'user') icon = 'm2';
|
||||||
|
@ -5666,7 +5666,7 @@
|
||||||
|
|
||||||
var msg = event.msg.split('(R)').join('®');
|
var msg = event.msg.split('(R)').join('®');
|
||||||
//if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
//if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
||||||
x += '<tr><td style=width:18px><div class=' + icon + '></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>' + time.toLocaleTimeString() + ' - ' + msg + '</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>';
|
x += '<tr><td style=width:18px><div class=' + icon + '></div></td><td class=g1 style=float:none> </td><td style=background-color:#C9C9C9>' + printTime(time) + ' - ' + msg + '</td><td class=g2 style=float:none> </td></tr><tr style=height:2px></tr>';
|
||||||
}
|
}
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
||||||
|
@ -6651,7 +6651,7 @@
|
||||||
|
|
||||||
// Figure out the date
|
// Figure out the date
|
||||||
var fdatestr = '';
|
var fdatestr = '';
|
||||||
if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
|
if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + " "; }
|
||||||
|
|
||||||
// Figure out the size
|
// Figure out the size
|
||||||
var fsize = '';
|
var fsize = '';
|
||||||
|
@ -6862,10 +6862,10 @@
|
||||||
for (var i in events) {
|
for (var i in events) {
|
||||||
var event = events[i], time = new Date(event.time);
|
var event = events[i], time = new Date(event.time);
|
||||||
if (event.msg) {
|
if (event.msg) {
|
||||||
if (time.toLocaleDateString() != dateHeader) {
|
if (printDate(time) != dateHeader) {
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
x += '<table class=p3eventsTable cellpadding=0 cellspacing=0><tr><td colspan=4 class=DevSt>' + time.toLocaleDateString() + '</td></tr>';
|
dateHeader = printDate(time);
|
||||||
dateHeader = time.toLocaleDateString();
|
x += '<table class=p3eventsTable cellpadding=0 cellspacing=0><tr><td colspan=4 class=DevSt>' + dateHeader + '</td></tr>';
|
||||||
}
|
}
|
||||||
var icon = 'si3';
|
var icon = 'si3';
|
||||||
if (event.etype == 'user') icon = 'm2';
|
if (event.etype == 'user') icon = 'm2';
|
||||||
|
@ -6873,7 +6873,7 @@
|
||||||
|
|
||||||
var msg = event.msg.split('(R)').join('®');
|
var msg = event.msg.split('(R)').join('®');
|
||||||
if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
|
||||||
x += '<tr onmouseover=eventMouseHover(this,1) onmouseout=eventMouseHover(this,0) style=cursor:pointer><td style=width:18px><div class=' + icon + '></div></td><td class=g1> </td><td class=style10>' + time.toLocaleTimeString() + ' - ' + msg + '</td><td class=g2> </td></tr><tr style=height:2px></tr>';
|
x += '<tr onmouseover=eventMouseHover(this,1) onmouseout=eventMouseHover(this,0) style=cursor:pointer><td style=width:18px><div class=' + icon + '></div></td><td class=g1> </td><td class=style10>' + printTime(time) + ' - ' + msg + '</td><td class=g2> </td></tr><tr style=height:2px></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
|
@ -7003,17 +7003,21 @@
|
||||||
}
|
}
|
||||||
if (sessions == 1) { lastAccess += '1 session'; } else { lastAccess += sessions + ' sessions'; }
|
if (sessions == 1) { lastAccess += '1 session'; } else { lastAccess += sessions + ' sessions'; }
|
||||||
} else {
|
} else {
|
||||||
if (user.login) { lastAccess += '<span title="Last login: ' + new Date(user.login * 1000).toLocaleString() + '">' + new Date(user.login * 1000).toLocaleDateString() + '</span>'; }
|
if (user.login) { lastAccess += '<span title="Last login: ' + printDateTime(new Date(user.login * 1000)) + '">' + printDate(new Date(user.login * 1000)) + '</span>'; }
|
||||||
}
|
}
|
||||||
if (self) { permissions += "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + encodeURIComponent(user._id) + "\")>"; }
|
if (self) { permissions += "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + encodeURIComponent(user._id) + "\")>"; }
|
||||||
if ((user.siteadmin != null) && ((user.siteadmin & 32) != 0) && (user.siteadmin != 0xFFFFFFFF)) { permissions += "Locked, "; }
|
if ((user.siteadmin != null) && ((user.siteadmin & 32) != 0) && (user.siteadmin != 0xFFFFFFFF)) { permissions += "Locked, "; }
|
||||||
permissions += "<span title='Server Permissions'>";
|
permissions += "<span title='Server Permissions'>";
|
||||||
if ((user.siteadmin == null) || (user.siteadmin == 0) || ((user.siteadmin & (0xFFFFFFFF - 224)) == 0)) {
|
|
||||||
|
var urights = user.siteadmin & (0xFFFFFFFF - 224);
|
||||||
|
if ((user.siteadmin == null) || (urights == 0)) {
|
||||||
permissions += "User";
|
permissions += "User";
|
||||||
} else if (user.siteadmin == 8) {
|
} else if (urights == 8) {
|
||||||
permissions += "User + Files";
|
permissions += "User + Files";
|
||||||
} else if (user.siteadmin == 0xFFFFFFFF) {
|
} else if (user.siteadmin == 0xFFFFFFFF) {
|
||||||
permissions += "Administrator";
|
permissions += "Administrator";
|
||||||
|
} else if ((urights & 2) != 0) {
|
||||||
|
permissions += "Manager";
|
||||||
} else {
|
} else {
|
||||||
permissions += "Partial";
|
permissions += "Partial";
|
||||||
}
|
}
|
||||||
|
@ -7208,14 +7212,14 @@
|
||||||
if (xxdialogMode) return;
|
if (xxdialogMode) return;
|
||||||
haltEvent(e);
|
haltEvent(e);
|
||||||
userid = decodeURIComponent(userid);
|
userid = decodeURIComponent(userid);
|
||||||
var x = '<div>';
|
var x = '<div><div id=d2AdminPermissions>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 id=ua_fileaccessquota>k max, blank for default<br><hr/>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 id=ua_fileaccessquota>k max, blank for default<br><hr/>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverupdate>Server Updates<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>';
|
||||||
x += '<hr/><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>';
|
x += '<hr/></div><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nonewgroups>No New Device Groups<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nonewgroups>No New Device Groups<br>';
|
||||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nomeshcmd>No Tools (MeshCmd/Router)<br>';
|
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nomeshcmd>No Tools (MeshCmd/Router)<br>';
|
||||||
x += '</div>';
|
x += '</div>';
|
||||||
|
@ -7239,6 +7243,7 @@
|
||||||
QE('ua_fileaccess', userinfo.siteadmin == 0xFFFFFFFF);
|
QE('ua_fileaccess', userinfo.siteadmin == 0xFFFFFFFF);
|
||||||
QE('ua_fileaccessquota', userinfo.siteadmin == 0xFFFFFFFF);
|
QE('ua_fileaccessquota', userinfo.siteadmin == 0xFFFFFFFF);
|
||||||
QE('ua_serverupdate', userinfo.siteadmin == 0xFFFFFFFF);
|
QE('ua_serverupdate', userinfo.siteadmin == 0xFFFFFFFF);
|
||||||
|
QV('d2AdminPermissions', userinfo.siteadmin == 0xFFFFFFFF)
|
||||||
QE('ua_lockedaccount', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
QE('ua_lockedaccount', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
||||||
QE('ua_nonewgroups', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
QE('ua_nonewgroups', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
||||||
QE('ua_nomeshcmd', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
QE('ua_nomeshcmd', (userinfo.siteadmin & 2) && (user.siteadmin != 0xFFFFFFFF) && (userinfo._id != user._id));
|
||||||
|
@ -7316,10 +7321,10 @@
|
||||||
}
|
}
|
||||||
x += addDeviceAttribute('Server Rights', premsg + "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + userid + "\")>" + msg.join(', ') + "</a>");
|
x += addDeviceAttribute('Server Rights', premsg + "<a style=cursor:pointer onclick=showUserAdminDialog(event,\"" + userid + "\")>" + msg.join(', ') + "</a>");
|
||||||
if (user.quota) x += addDeviceAttribute('Server Quota', EscapeHtml(parseInt(user.quota) / 1024) + ' k');
|
if (user.quota) x += addDeviceAttribute('Server Quota', EscapeHtml(parseInt(user.quota) / 1024) + ' k');
|
||||||
x += addDeviceAttribute('Creation', new Date(user.creation * 1000).toLocaleString());
|
x += addDeviceAttribute('Creation', printDateTime(new Date(user.creation * 1000)));
|
||||||
if (user.login) x += addDeviceAttribute('Last Login', new Date(user.login * 1000).toLocaleString());
|
if (user.login) x += addDeviceAttribute('Last Login', printDateTime(new Date(user.login * 1000)));
|
||||||
if (user.passchange == -1) { x += addDeviceAttribute('Password', 'Will be changed on next login.'); }
|
if (user.passchange == -1) { x += addDeviceAttribute('Password', 'Will be changed on next login.'); }
|
||||||
else if (user.passchange) { x += addDeviceAttribute('Password', 'Last changed: ' + new Date(user.passchange * 1000).toLocaleString()); }
|
else if (user.passchange) { x += addDeviceAttribute('Password', 'Last changed: ' + printDateTime(new Date(user.passchange * 1000))); }
|
||||||
|
|
||||||
// Device Groups
|
// Device Groups
|
||||||
var linkCount = 0, linkCountStr = '<i>None<i>';
|
var linkCount = 0, linkCountStr = '<i>None<i>';
|
||||||
|
@ -7496,12 +7501,12 @@
|
||||||
var te = Math.min(Math.min(end, block[1]), now);
|
var te = Math.min(Math.min(end, block[1]), now);
|
||||||
var width = Math.round((te - ts) / 112794);
|
var width = Math.round((te - ts) / 112794);
|
||||||
if (width > 0) {
|
if (width > 0) {
|
||||||
var title = powerStateStrings2[block[2]] + ' from ' + new Date(ts).toLocaleTimeString() + ' to ' + new Date(te).toLocaleTimeString() + '.';
|
var title = powerStateStrings2[block[2]] + ' from ' + printTime(new Date(ts)) + ' to ' + printTime(new Date(te)) + '.';
|
||||||
datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
|
datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x += '<tr style=' + (((count % 2) == 0)?'background-color:#DDD':'') + '><td><div> ' + date.toLocaleDateString() + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
x += '<tr style=' + (((count % 2) == 0)?'background-color:#DDD':'') + '><td><div> ' + printDate(date) + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
|
||||||
++count;
|
++count;
|
||||||
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
|
||||||
}
|
}
|
||||||
|
@ -7518,10 +7523,10 @@
|
||||||
for (var i in currentUserEvents) {
|
for (var i in currentUserEvents) {
|
||||||
var event = currentUserEvents[i];
|
var event = currentUserEvents[i];
|
||||||
var time = new Date(event.time);
|
var time = new Date(event.time);
|
||||||
if (time.toLocaleDateString() != dateHeader) {
|
if (printDate(time) != dateHeader) {
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>' + time.toLocaleDateString() + '</td></tr>';
|
dateHeader = printDate(time);
|
||||||
dateHeader = time.toLocaleDateString();
|
x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>' + dateHeader + '</td></tr>';
|
||||||
}
|
}
|
||||||
var icon = 'si3';
|
var icon = 'si3';
|
||||||
if (event.etype == 'user') icon = 'm2';
|
if (event.etype == 'user') icon = 'm2';
|
||||||
|
@ -7532,7 +7537,7 @@
|
||||||
x += '<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>';
|
x += '<tr><td><div class=bar18 style=height:18px;width:100%;font-size:medium>';
|
||||||
x += '<div style=float:left;height:18px;width:18px;background-color:white><div class=' + icon + ' style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
|
x += '<div style=float:left;height:18px;width:18px;background-color:white><div class=' + icon + ' style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
|
||||||
x += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
|
x += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
|
||||||
x += '<div style=font-size:14px><span style=width:300px>' + time.toLocaleTimeString() + ' - ' + msg + '</span></div></div></td></tr>';
|
x += '<div style=font-size:14px><span style=width:300px>' + printTime(time) + ' - ' + msg + '</span></div></div></td></tr>';
|
||||||
}
|
}
|
||||||
if (dateHeader != null) x += '</table>';
|
if (dateHeader != null) x += '</table>';
|
||||||
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
if (x == '') x = "<br><i>No Events Found</i><br><br>";
|
||||||
|
@ -7672,7 +7677,7 @@
|
||||||
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' }
|
if (node != null) { icon = node.icon; t = '<b>' + node.name + '</b>: ' }
|
||||||
}
|
}
|
||||||
|
|
||||||
r += '<div title="Occured at ' + d.toLocaleString() + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
|
r += '<div title="Occured at ' + printDateTime(d) + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '') ? 'transparent' : 'orange') + '">';
|
||||||
if (icon) { r += '<div class=j' + icon + ' onclick="notificationSelected(' + n.id + ')" style=margin:5px;float:left></div>'; }
|
if (icon) { r += '<div class=j' + icon + ' onclick="notificationSelected(' + n.id + ')" style=margin:5px;float:left></div>'; }
|
||||||
r += '<div onclick="notificationDelete(' + n.id + ')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected(' + n.id + ')" style=margin:5px>' + t + n.text + '</div></div>';
|
r += '<div onclick="notificationDelete(' + n.id + ')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected(' + n.id + ')" style=margin:5px>' + t + n.text + '</div></div>';
|
||||||
}
|
}
|
||||||
|
@ -8135,7 +8140,9 @@
|
||||||
function u2fSupported() { return (window.u2f && ((navigator.userAgent.indexOf('Chrome/') > 0) || (navigator.userAgent.indexOf('Firefox/') > 0) || (navigator.userAgent.indexOf('Opera/') > 0) || (navigator.userAgent.indexOf('Safari/') > 0))); }
|
function u2fSupported() { return (window.u2f && ((navigator.userAgent.indexOf('Chrome/') > 0) || (navigator.userAgent.indexOf('Firefox/') > 0) || (navigator.userAgent.indexOf('Opera/') > 0) || (navigator.userAgent.indexOf('Safari/') > 0))); }
|
||||||
function findOne(arr1, arr2) { if ((arr1 == null) || (arr2 == null)) return false; return arr2.some(function (v) { return arr1.indexOf(v) >= 0; }); };
|
function findOne(arr1, arr2) { if ((arr1 == null) || (arr2 == null)) return false; return arr2.some(function (v) { return arr1.indexOf(v) >= 0; }); };
|
||||||
function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
|
function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
|
||||||
|
function printDate(d) { return d.toLocaleDateString(args.locale); }
|
||||||
|
function printTime(d) { return d.toLocaleTimeString(args.locale); }
|
||||||
|
function printDateTime(d) { return d.toLocaleString(args.locale); }
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
18
webserver.js
18
webserver.js
|
@ -917,7 +917,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||||
var email = req.body.email;
|
var email = req.body.email;
|
||||||
if ((email == null) || (email == '')) { email = req.session.tokenemail; }
|
if ((email == null) || (email == '')) { email = req.session.tokenemail; }
|
||||||
|
|
||||||
// Check the email stirng format
|
// Check the email string format
|
||||||
if (!email || checkEmail(email) == false) {
|
if (!email || checkEmail(email) == false) {
|
||||||
req.session.loginmode = '3';
|
req.session.loginmode = '3';
|
||||||
req.session.error = '<b style=color:#8C001A>Invalid email.</b>';
|
req.session.error = '<b style=color:#8C001A>Invalid email.</b>';
|
||||||
|
@ -929,45 +929,59 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||||
req.session.error = '<b style=color:#8C001A>Account not found.</b>';
|
req.session.error = '<b style=color:#8C001A>Account not found.</b>';
|
||||||
res.redirect(domain.url);
|
res.redirect(domain.url);
|
||||||
} else {
|
} else {
|
||||||
var user = docs[0];
|
// If many accounts have the same validated e-mail, we are going to use the first one for display, but sent a reset email for all accounts.
|
||||||
|
var responseSent = false;
|
||||||
|
for (var i in docs) {
|
||||||
|
var user = docs[i];
|
||||||
if (checkUserOneTimePasswordRequired(domain, user) == true) {
|
if (checkUserOneTimePasswordRequired(domain, user) == true) {
|
||||||
// Second factor setup, request it now.
|
// Second factor setup, request it now.
|
||||||
checkUserOneTimePassword(req, domain, user, req.body.token, req.body.hwtoken, function (result) {
|
checkUserOneTimePassword(req, domain, user, req.body.token, req.body.hwtoken, function (result) {
|
||||||
if (result == false) {
|
if (result == false) {
|
||||||
|
if (i == 0) {
|
||||||
// 2-step auth is required, but the token is not present or not valid.
|
// 2-step auth is required, but the token is not present or not valid.
|
||||||
if ((req.body.token != null) || (req.body.hwtoken != null)) { req.session.error = '<b style=color:#8C001A>Invalid token, try again.</b>'; }
|
if ((req.body.token != null) || (req.body.hwtoken != null)) { req.session.error = '<b style=color:#8C001A>Invalid token, try again.</b>'; }
|
||||||
req.session.loginmode = '5';
|
req.session.loginmode = '5';
|
||||||
req.session.tokenemail = email;
|
req.session.tokenemail = email;
|
||||||
res.redirect(domain.url);
|
res.redirect(domain.url);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Send email to perform recovery.
|
// Send email to perform recovery.
|
||||||
delete req.session.tokenemail;
|
delete req.session.tokenemail;
|
||||||
if (obj.parent.mailserver != null) {
|
if (obj.parent.mailserver != null) {
|
||||||
obj.parent.mailserver.sendAccountResetMail(domain, user.name, user.email);
|
obj.parent.mailserver.sendAccountResetMail(domain, user.name, user.email);
|
||||||
|
if (i == 0) {
|
||||||
req.session.loginmode = '1';
|
req.session.loginmode = '1';
|
||||||
req.session.error = '<b style=color:darkgreen>Hold on, reset mail sent.</b>';
|
req.session.error = '<b style=color:darkgreen>Hold on, reset mail sent.</b>';
|
||||||
res.redirect(domain.url);
|
res.redirect(domain.url);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (i == 0) {
|
||||||
req.session.loginmode = '3';
|
req.session.loginmode = '3';
|
||||||
req.session.error = '<b style=color:#8C001A>Unable to sent email.</b>';
|
req.session.error = '<b style=color:#8C001A>Unable to sent email.</b>';
|
||||||
res.redirect(domain.url);
|
res.redirect(domain.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// No second factor, send email to perform recovery.
|
// No second factor, send email to perform recovery.
|
||||||
if (obj.parent.mailserver != null) {
|
if (obj.parent.mailserver != null) {
|
||||||
obj.parent.mailserver.sendAccountResetMail(domain, user.name, user.email);
|
obj.parent.mailserver.sendAccountResetMail(domain, user.name, user.email);
|
||||||
|
if (i == 0) {
|
||||||
req.session.loginmode = '1';
|
req.session.loginmode = '1';
|
||||||
req.session.error = '<b style=color:darkgreen>Hold on, reset mail sent.</b>';
|
req.session.error = '<b style=color:darkgreen>Hold on, reset mail sent.</b>';
|
||||||
res.redirect(domain.url);
|
res.redirect(domain.url);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (i == 0) {
|
||||||
req.session.loginmode = '3';
|
req.session.loginmode = '3';
|
||||||
req.session.error = '<b style=color:#8C001A>Unable to sent email.</b>';
|
req.session.error = '<b style=color:#8C001A>Unable to sent email.</b>';
|
||||||
res.redirect(domain.url);
|
res.redirect(domain.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue