mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added view previous logins.
This commit is contained in:
parent
1b4f2f6002
commit
76d93e7d1e
11 changed files with 3685 additions and 2603 deletions
10
meshuser.js
10
meshuser.js
|
@ -5383,6 +5383,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
console.log(command.value);
|
||||
break;
|
||||
}
|
||||
case 'previousLogins': {
|
||||
// TODO: Make a better database call to get filtered data.
|
||||
db.GetUserEvents([user._id], domain.id, user._id.split('/')[2], function (err, docs) {
|
||||
if (err != null) return;
|
||||
var e = [];
|
||||
for (var i in docs) { if ((docs[i].msgArgs) && ((docs[i].action == 'authfail') || (docs[i].action == 'login'))) { e.push({ t: docs[i].time, m: docs[i].msgid, a: docs[i].msgArgs }); } }
|
||||
try { ws.send(JSON.stringify({ action: 'previousLogins', events: e })); } catch (ex) { }
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// Unknown user action
|
||||
console.log('Unknown action from user ' + user.name + ': ' + command.action + '.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue