Updated MeshCentral Router

Ylian Saint-Hilaire committed Apr 22, 2020 at 21:08 UTC f484c6742c3a5d2955466e289b1aea5819a01009
3 files changed +11 -6
agents/MeshCentralRouter.exe
Binary files a/agents/MeshCentralRouter.exe and b/agents/MeshCentralRouter.exe differ
views/default-mobile.handlebars
+10 -5
@@ -259,10 +259,10 @@
259 <div id="p3AccountActions">
260 <p><strong>Account Security</strong></p>
261 <div style="margin-left:9px;margin-bottom:8px">
262 - <div id="managePhoneNumber1" style="margin-top:5px;display:none"><a onclick="account_managePhone()" style="cursor:pointer">Manage phone number</a></div>
263 - <div id="manageEmail2FA" style="margin-top:5px;display:none"><a onclick="account_manageAuthEmail()" style="cursor:pointer">Manage email authentication</a></div>
264 - <div id="manageAuthApp" style="margin-top:5px;display:none"><a onclick="account_manageAuthApp()" style="cursor:pointer">Manage authenticator app</a></div>
265 - <div id="manageOtp" style="margin-top:5px;display:none"><a onclick="account_manageOtp(0)" style="cursor:pointer">Manage backup codes</a></div>
262 + <div id="managePhoneNumber1" style="margin-top:5px;display:none"><a onclick="account_managePhone()" style="cursor:pointer">Manage phone number</a> <span id="authPhoneNumberCheck"><strong>&#x2713;</strong></span></div>
263 + <div id="manageEmail2FA" style="margin-top:5px;display:none"><a onclick="account_manageAuthEmail()" style="cursor:pointer">Manage email authentication</a> <span id="authEmailSetupCheck"><strong>&#x2713;</strong></span></div>
264 + <div id="manageAuthApp" style="margin-top:5px;display:none"><a onclick="account_manageAuthApp()" style="cursor:pointer">Manage authenticator app</a> <span id="authAppSetupCheck"><strong>&#x2713;</strong></span></div>
265 + <div id="manageOtp" style="margin-top:5px;display:none"><a onclick="account_manageOtp(0)" style="cursor:pointer">Manage backup codes</a> <span id="authCodesSetupCheck"><strong>&#x2713;</strong></span></div>
266 </div>
267 <p><strong>Account Actions</strong></p>
268 <div style="margin-left:9px;margin-bottom:8px">
@@ -720,6 +720,11 @@
720 QV('verifyEmailId', (userinfo.emailVerified !== true) && (userinfo.email != null) && (serverinfo.emailcheck == true));
721 QV('manageAuthApp', features & 4096);
722 QV('manageOtp', ((features & 4096) != 0) && ((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0)));
723 + QV('authPhoneNumberCheck', (userinfo.phone != null));
724 + QV('authEmailSetupCheck', (userinfo.otpekey == 1) && (userinfo.email != null) && (userinfo.emailVerified == true));
725 + QV('authAppSetupCheck', userinfo.otpsecret == 1);
726 + //QV('authKeySetupCheck', userinfo.otphkeys > 0);
727 + QV('authCodesSetupCheck', userinfo.otpkeys > 0);
728
729 // On the mobile app, don't allow group creation (for now).
730 QV('p3createMeshLink1', false);
@@ -1309,7 +1314,7 @@
1314
1315 function account_manageOtp(action) {
1316 if ((xxdialogMode == 2) && (xxdialogTag == 'otpauth-manage')) { dialogclose(0); }
1312 - if (xxdialogMode || (userinfo.otpsecret != 1) || ((features & 4096) == 0)) return;
1317 + if (xxdialogMode || ((features & 4096) == 0) || ((userinfo.otpsecret != 1) && (userinfo.otphkeys < 1))) return;
1318 meshserver.send({ action: 'otpauth-getpasswords', subaction: action });
1319 }
1320
webserver.js
+1 -1
@@ -4143,7 +4143,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4143 var email2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (parent.mailserver != null) && (user.otpekey != null));
4144 var sms2fa = (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false)) && (parent.smsserver != null) && (user.phone != null));
4145 if (s.length != 3) {
4146 - try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa })); ws.close(); } catch (e) { }
4146 + try { ws.send(JSON.stringify({ action: 'close', cause: 'noauth', msg: 'tokenrequired', email2fa: email2fa, sms2fa: sms2fa })); ws.close(); } catch (e) { }
4147 } else {
4148 checkUserOneTimePassword(req, domain, user, s[2], null, function (result) {
4149 if (result == false) {