mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-27 07:35:53 -05:00
commit
89804385bb
@ -91,7 +91,7 @@ module.exports.CreateLetsEncrypt = function (parent) {
|
||||
// Decode the certificate common and alt names
|
||||
obj.certNames = [cert.subject.getField('CN').value];
|
||||
var altNames = cert.getExtension('subjectAltName');
|
||||
if (altNames) { for (i = 0; i < altNames.altNames.length; i++) { var acn = altNames.altNames[i].value.toLowerCase(); if (obj.certNames.indexOf(acn) == -1) { obj.certNames.push(acn); } } }
|
||||
if (altNames) { for (var i = 0; i < altNames.altNames.length; i++) { var acn = altNames.altNames[i].value.toLowerCase(); if (obj.certNames.indexOf(acn) == -1) { obj.certNames.push(acn); } } }
|
||||
|
||||
// Decode the certificate expire time
|
||||
obj.certExpire = cert.validity.notAfter;
|
||||
|
@ -1958,7 +1958,7 @@ function CreateMeshCentralServer(config, args) {
|
||||
for (var i in ids) { var id = ids[i]; if (!obj.eventsDispatch[id]) { obj.eventsDispatch[id] = [target]; } else { obj.eventsDispatch[id].push(target); } }
|
||||
};
|
||||
obj.RemoveEventDispatch = function (ids, target) {
|
||||
obj.debug('dispatch', 'RemoveEventDispatch', id);
|
||||
obj.debug('dispatch', 'RemoveEventDispatch', ids);
|
||||
for (var i in ids) { var id = ids[i]; if (obj.eventsDispatch[id]) { var j = obj.eventsDispatch[id].indexOf(target); if (j >= 0) { if (obj.eventsDispatch[id].length == 1) { delete obj.eventsDispatch[id]; } else { obj.eventsDispatch[id].splice(j, 1); } } } }
|
||||
};
|
||||
obj.RemoveEventDispatchId = function (id) {
|
||||
|
@ -6287,6 +6287,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
// A user/pass is provided in URL arguments
|
||||
obj.authenticate(req.query.user, req.query.pass, domain, function (err, userid, passhint, loginOptions) {
|
||||
|
||||
var user = obj.users[userid];
|
||||
|
||||
// Check if user as the "notools" site right. If so, deny this connection as tools are not allowed to connect.
|
||||
if ((user != null) && (user.siteadmin != 0xFFFFFFFF) && (user.siteadmin & SITERIGHT_NOMESHCMD)) {
|
||||
// No tools allowed, close the websocket connection
|
||||
@ -6299,7 +6301,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
var twoFactorCookieDays = 30;
|
||||
if (typeof domain.twofactorcookiedurationdays == 'number') { twoFactorCookieDays = domain.twofactorcookiedurationdays; }
|
||||
|
||||
var user = obj.users[userid];
|
||||
if ((err == null) && (user)) {
|
||||
// Check if a 2nd factor is needed
|
||||
if (checkUserOneTimePasswordRequired(domain, user, req, loginOptions) == true) {
|
||||
|
Loading…
Reference in New Issue
Block a user