mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 23:25:53 -05:00
Fixed using timed OTP when backup codes are not allowed (#4268)
This commit is contained in:
parent
636f801bd7
commit
138fc507c8
@ -3330,9 +3330,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
// Do not allow this command if 2FA's are locked
|
// Do not allow this command if 2FA's are locked
|
||||||
if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 1 })); return; }
|
if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 1 })); return; }
|
||||||
|
|
||||||
// Do not allow this command if backup codes are not allowed
|
|
||||||
if ((domain.passwordrequirements) && (domain.passwordrequirements.backupcode2factor == false)) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 2 })); return; }
|
|
||||||
|
|
||||||
// Do not allow this command when logged in using a login token
|
// Do not allow this command when logged in using a login token
|
||||||
if (req.session.loginToken != null) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 3 })); return; }
|
if (req.session.loginToken != null) { ws.send(JSON.stringify({ action: 'otpauth-request', err: 3 })); return; }
|
||||||
|
|
||||||
@ -3361,9 +3358,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
// Do not allow this command if 2FA's are locked
|
// Do not allow this command if 2FA's are locked
|
||||||
if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) return;
|
if ((domain.passwordrequirements) && (domain.passwordrequirements.lock2factor == true)) return;
|
||||||
|
|
||||||
// Do not allow this command if backup codes are not allowed
|
|
||||||
if ((domain.passwordrequirements) && (domain.passwordrequirements.backupcode2factor == false)) return;
|
|
||||||
|
|
||||||
// Do not allow this command when logged in using a login token
|
// Do not allow this command when logged in using a login token
|
||||||
if (req.session.loginToken != null) break;
|
if (req.session.loginToken != null) break;
|
||||||
|
|
||||||
|
@ -2931,11 +2931,9 @@
|
|||||||
QS('dialog').bottom = '80px';
|
QS('dialog').bottom = '80px';
|
||||||
QS('dialog').top = QS('dialog').left = QS('dialog').right = '100px';
|
QS('dialog').top = QS('dialog').left = QS('dialog').right = '100px';
|
||||||
if (d4EditEncodingVal == 1) {
|
if (d4EditEncodingVal == 1) {
|
||||||
// UTF8 Encoding
|
Q('d4editorarea').value = decode_utf8(atob(message.data)); // UTF8 Encoding
|
||||||
Q('d4editorarea').value = decode_utf8(atob(message.data));
|
|
||||||
} else {
|
} else {
|
||||||
// RAW Encoding
|
Q('d4editorarea').value = atob(message.data); // RAW Encoding
|
||||||
Q('d4editorarea').value = atob(message.data);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -10717,11 +10715,9 @@
|
|||||||
QS('dialog').bottom = '80px';
|
QS('dialog').bottom = '80px';
|
||||||
QS('dialog').top = QS('dialog').left = QS('dialog').right = '100px';
|
QS('dialog').top = QS('dialog').left = QS('dialog').right = '100px';
|
||||||
if (d4EditEncodingVal == 1) {
|
if (d4EditEncodingVal == 1) {
|
||||||
// UTF8 Encoding
|
Q('d4editorarea').value = decode_utf8(gdownloadFile.data); // UTF8 Encoding
|
||||||
Q('d4editorarea').value = decode_utf8(gdownloadFile.data);
|
|
||||||
} else {
|
} else {
|
||||||
// RAW Encoding
|
Q('d4editorarea').value = gdownloadFile.data; // RAW Encoding
|
||||||
Q('d4editorarea').value = gdownloadFile.data;
|
|
||||||
}
|
}
|
||||||
gdownloadFile = null;
|
gdownloadFile = null;
|
||||||
} else {
|
} else {
|
||||||
@ -10767,11 +10763,9 @@
|
|||||||
function p13editSaveBack(b, tag) {
|
function p13editSaveBack(b, tag) {
|
||||||
var data;
|
var data;
|
||||||
if (d4EditEncodingVal == 1) {
|
if (d4EditEncodingVal == 1) {
|
||||||
// UTF8 encoding
|
data = new TextEncoder().encode(Q('d4editorarea').value); // UTF8 encoding
|
||||||
data = new TextEncoder().encode(Q('d4editorarea').value);
|
|
||||||
} else {
|
} else {
|
||||||
// RAW encoding
|
data = new TextEncoder().encode(decode_utf8(Q('d4editorarea').value)); // RAW encoding
|
||||||
data = new TextEncoder().encode(decode_utf8(Q('d4editorarea').value));
|
|
||||||
}
|
}
|
||||||
p13uploadFileContinue(1, [{ name: tag, size: data.byteLength, type: 'text/plain', xdata: data }]);
|
p13uploadFileContinue(1, [{ name: tag, size: data.byteLength, type: 'text/plain', xdata: data }]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user