From f51cadef25afc7e2529c4c31f1481ecb9dc3bbad Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 27 May 2020 01:17:03 -0700 Subject: [PATCH] Improved MeshCtrl.js error message. --- meshctrl.js | 8 ++++++-- sample-config-advanced.json | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/meshctrl.js b/meshctrl.js index 4d6782eb..f6cd5b19 100644 --- a/meshctrl.js +++ b/meshctrl.js @@ -569,7 +569,7 @@ function serverConnect() { var keydata = fs.readFileSync(args.loginkeyfile, 'utf8').split(' ').join('').split('\r').join('').split('\n').join(''); ckey = Buffer.from(keydata, 'hex'); if (ckey.length != 80) { console.log("Invalid login key file."); process.exit(); return; } - } catch (ex) { console.log(ex); process.exit(); return; } + } catch (ex) { console.log(ex.message); process.exit(); return; } } if (ckey != null) { @@ -961,7 +961,11 @@ function serverConnect() { if (data.msg == 'tokenrequired') { console.log('Authentication token required, use --token [number].'); } else { - console.log('Invalid login.'); + if ((args.loginkeyfile != null) || (args.loginkey != null)) { + console.log('Invalid login, check the login key and that this computer has the correct time.'); + } else { + console.log('Invalid login.'); + } } } process.exit(); diff --git a/sample-config-advanced.json b/sample-config-advanced.json index 17616c2c..a00d2b51 100644 --- a/sample-config-advanced.json +++ b/sample-config-advanced.json @@ -162,45 +162,45 @@ "_authStrategies": { "__comment__" : "This section is used to allow users to login using other accounts. You will need to get an API key from the services and register callback URL's", "twitter": { - "__callbackurl": "https://server/auth-twitter-callback", + "_callbackurl": "https://server/auth-twitter-callback", "newAccounts": true, "clientid": "xxxxxxxxxxxxxxxxxxxxxxx", "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, "google": { - "__callbackurl": "https://server/auth-google-callback", + "_callbackurl": "https://server/auth-google-callback", "newAccounts": true, "clientid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxx" }, "github": { - "__callbackurl": "https://server/auth-github-callback", + "_callbackurl": "https://server/auth-github-callback", "newAccounts": true, "clientid": "xxxxxxxxxxxxxxxxxxxxxxx", "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, "reddit": { - "__callbackurl": "https://server/auth-reddit-callback", + "_callbackurl": "https://server/auth-reddit-callback", "newAccounts": true, "clientid": "xxxxxxxxxxxxxxxxxxxxxxx", "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, "azure": { - "__callbackurl": "https://server/auth-azure-callback", + "_callbackurl": "https://server/auth-azure-callback", "newAccounts": true, "clientid": "00000000-0000-0000-0000-000000000000", "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "tenantid": "00000000-0000-0000-0000-000000000000" }, "jumpcloud": { - "__callbackurl": "https://server/auth-jumpcloud-callback", + "_callbackurl": "https://server/auth-jumpcloud-callback", "newAccounts": true, "entityid": "meshcentral", "idpurl": "https://sso.jumpcloud.com/saml2/saml2", "cert": "jumpcloud-saml.pem" }, "saml": { - "__callbackurl": "https://server/auth-saml-callback", + "_callbackurl": "https://server/auth-saml-callback", "newAccounts": true, "entityid": "meshcentral", "idpurl": "https://server/saml2",