mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-24 13:13:13 -05:00
Sysinfo doc now live update, improved 2FA backup codes dialog.
This commit is contained in:
parent
c331681ad1
commit
b87b5e93a4
@ -1912,7 +1912,9 @@ function createMeshCore(agent)
|
||||
}
|
||||
case 'sysinfo': { // Return system information
|
||||
getSystemInformation(function (results, err) {
|
||||
if (results == null) { sendConsoleText(err, this.sessionid); } else { sendConsoleText(JSON.stringify(results, null, 1), this.sessionid); }
|
||||
if (results == null) { sendConsoleText(err, this.sessionid); } else {
|
||||
sendConsoleText(JSON.stringify(results, null, 1), this.sessionid);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
4
agents/meshcore.min.js
vendored
4
agents/meshcore.min.js
vendored
@ -1912,7 +1912,9 @@ function createMeshCore(agent)
|
||||
}
|
||||
case 'sysinfo': { // Return system information
|
||||
getSystemInformation(function (results, err) {
|
||||
if (results == null) { sendConsoleText(err, this.sessionid); } else { sendConsoleText(JSON.stringify(results, null, 1), this.sessionid); }
|
||||
if (results == null) { sendConsoleText(err, this.sessionid); } else {
|
||||
sendConsoleText(JSON.stringify(results, null, 1), this.sessionid);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
17
meshagent.js
17
meshagent.js
@ -1307,12 +1307,17 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
break;
|
||||
}
|
||||
case 'sysinfo': {
|
||||
//console.log('sysinfo', obj.nodeid, JSON.stringify(command.data.hash));
|
||||
command.data._id = 'si' + obj.dbNodeKey;
|
||||
command.data.type = 'sysinfo';
|
||||
command.data.domain = domain.id;
|
||||
command.data.time = Date.now();
|
||||
db.Set(command.data); // Update system information in the database.
|
||||
if ((typeof command.data == 'object') && (typeof command.data.hash == 'string')) {
|
||||
command.data._id = 'si' + obj.dbNodeKey;
|
||||
command.data.type = 'sysinfo';
|
||||
command.data.domain = domain.id;
|
||||
command.data.time = Date.now();
|
||||
db.Set(command.data); // Update system information in the database.
|
||||
|
||||
// Event the new sysinfo hash, this will notify everyone that the sysinfo document was changed
|
||||
var event = { etype: 'node', action: 'sysinfohash', nodeid: obj.dbNodeKey, domain: domain.id, hash: command.data.hash, nolog: 1 };
|
||||
parent.parent.DispatchEvent(['*', obj.dbMeshKey], obj, event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'sysinfocheck': {
|
||||
|
16
meshuser.js
16
meshuser.js
@ -2529,16 +2529,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
if (twoStepLoginSupported == false) break;
|
||||
|
||||
// Perform a sub-action
|
||||
var actionTaken = false;
|
||||
var actionTaken = false, actionText = null;
|
||||
if (command.subaction == 1) { // Generate a new set of tokens
|
||||
var randomNumbers = [], v;
|
||||
for (var i = 0; i < 10; i++) { do { v = getRandomEightDigitInteger(); } while (randomNumbers.indexOf(v) >= 0); randomNumbers.push(v); }
|
||||
user.otpkeys = { keys: [] };
|
||||
for (var i = 0; i < 10; i++) { user.otpkeys.keys[i] = { p: randomNumbers[i], u: true } }
|
||||
actionTaken = true;
|
||||
actionText = 'New 2FA backup codes generated.';
|
||||
} else if (command.subaction == 2) { // Clear all tokens
|
||||
actionTaken = (user.otpkeys != null);
|
||||
user.otpkeys = null;
|
||||
if (actionTaken) { actionText = '2FA backup codes cleared.'; }
|
||||
}
|
||||
|
||||
// Save the changed user
|
||||
@ -2550,11 +2552,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
}
|
||||
|
||||
// Notify change
|
||||
var targets = ['*', 'server-users', user._id];
|
||||
if (user.groups) { for (var i in user.groups) { targets.push('server-users:' + i); } }
|
||||
var event = { etype: 'user', userid: user._id, username: user.name, account: parent.CloneSafeUser(user), action: 'accountchange', msg: 'Added security key.', domain: domain.id };
|
||||
if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come.
|
||||
parent.parent.DispatchEvent(targets, obj, event);
|
||||
if (actionText != null) {
|
||||
var targets = ['*', 'server-users', user._id];
|
||||
if (user.groups) { for (var i in user.groups) { targets.push('server-users:' + i); } }
|
||||
var event = { etype: 'user', userid: user._id, username: user.name, account: parent.CloneSafeUser(user), action: 'accountchange', msg: actionText, domain: domain.id };
|
||||
if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user. Another event will come.
|
||||
parent.parent.DispatchEvent(targets, obj, event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'otp-hkey-get':
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.4.1-d",
|
||||
"version": "0.4.1-e",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
@ -1556,6 +1556,11 @@ a {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.filelist:hover {
|
||||
background: #EEE;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.noselect {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1494,7 +1494,7 @@
|
||||
}
|
||||
case 'getsysinfo': {
|
||||
if (message.nodeid != powerTimelineReq) break;
|
||||
console.log('getsysinfo', message);
|
||||
//console.log('getsysinfo', message); // ***********************
|
||||
if (message.noinfo === true) {
|
||||
QH('p17info', 'No information for this device.');
|
||||
} else {
|
||||
@ -1748,12 +1748,18 @@
|
||||
var x = "One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place.";
|
||||
x += "<div style='border-radius:6px;border: 2px dashed #888;width:100%;margin-top:8px'><div style='padding:8px;font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold'><table class=selecttext style=width:100%;text-align:center>";
|
||||
if (message.passwords) {
|
||||
var j = 0;
|
||||
var j = 0, clipb = '';
|
||||
for (var i in message.passwords) {
|
||||
if (++j % 2) { x += '<tr>'; }
|
||||
var p = '' + message.passwords[i].p;
|
||||
while (p.length < 8) { p = '0' + p; }
|
||||
if (message.passwords[i].u === true) { x += '<td>' + p.substring(0, 4) + ' ' + p.substring(4); } else { x += '<td><strike style=color:#BBB>' + p.substring(0, 4) + ' ' + p.substring(4); + '</strike>'; }
|
||||
if (message.passwords[i].u === true) {
|
||||
x += '<td>' + p.substring(0, 4) + ' ' + p.substring(4);
|
||||
if (clipb != '') { clipb += ' '; }
|
||||
clipb += p;
|
||||
} else {
|
||||
x += '<td><strike style=color:#BBB>' + p.substring(0, 4) + ' ' + p.substring(4); + '</strike>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
x += '<tr><td>No Active Tokens';
|
||||
@ -1761,7 +1767,10 @@
|
||||
x += "</table></div></div><br />";
|
||||
x += "<div><input type=button value='Close' onclick=setDialogMode(0) style=float:right></input>";
|
||||
x += "<input type=button value='Generate New Tokens' onclick='account_manageOtp(1);'></input>";
|
||||
if (message.passwords != null) { x += "<input type=button value='Clear Tokens' onclick='account_manageOtp(2);'></input>"; }
|
||||
if (message.passwords != null) {
|
||||
x += "<input type=button value='Clear Tokens' onclick='account_manageOtp(2);'></input>";
|
||||
x += ' <img src=images/link4.png height=10 width=10 title="Copy valid codes to clipboard" style=cursor:pointer onclick=copyTextToClip2("' + encodeURIComponent(clipb) + '")>';
|
||||
}
|
||||
x += "</div><br />";
|
||||
setDialogMode(2, "Manage Backup Codes", 8, null, x, 'otpauth-manage');
|
||||
break;
|
||||
@ -2209,6 +2218,13 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'sysinfohash': {
|
||||
// If the sysinfo document has changed and we are looking at it, request an update.
|
||||
if ((currentNode != null) && (message.event.nodeid == powerTimelineReq)) {
|
||||
meshserver.send({ action: 'getsysinfo', nodeid: message.event.nodeid });
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'stopped': { // Server is stopping.
|
||||
// Disconnect
|
||||
//console.log(message.msg);
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user