Improved MeshCtrl.js error message.

This commit is contained in:
Ylian Saint-Hilaire 2020-05-27 01:17:03 -07:00
parent 4014973228
commit d8bebb719e
2 changed files with 13 additions and 9 deletions

View File

@ -569,7 +569,7 @@ function serverConnect() {
var keydata = fs.readFileSync(args.loginkeyfile, 'utf8').split(' ').join('').split('\r').join('').split('\n').join(''); var keydata = fs.readFileSync(args.loginkeyfile, 'utf8').split(' ').join('').split('\r').join('').split('\n').join('');
ckey = Buffer.from(keydata, 'hex'); ckey = Buffer.from(keydata, 'hex');
if (ckey.length != 80) { console.log("Invalid login key file."); process.exit(); return; } 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) { if (ckey != null) {
@ -960,10 +960,14 @@ function serverConnect() {
if (data.cause == 'noauth') { if (data.cause == 'noauth') {
if (data.msg == 'tokenrequired') { if (data.msg == 'tokenrequired') {
console.log('Authentication token required, use --token [number].'); console.log('Authentication token required, use --token [number].');
} else {
if ((args.loginkeyfile != null) || (args.loginkey != null)) {
console.log('Invalid login, check the login key and that this computer has the correct time.');
} else { } else {
console.log('Invalid login.'); console.log('Invalid login.');
} }
} }
}
process.exit(); process.exit();
break; break;
} }

View File

@ -162,45 +162,45 @@
"_authStrategies": { "_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", "__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": { "twitter": {
"__callbackurl": "https://server/auth-twitter-callback", "_callbackurl": "https://server/auth-twitter-callback",
"newAccounts": true, "newAccounts": true,
"clientid": "xxxxxxxxxxxxxxxxxxxxxxx", "clientid": "xxxxxxxxxxxxxxxxxxxxxxx",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}, },
"google": { "google": {
"__callbackurl": "https://server/auth-google-callback", "_callbackurl": "https://server/auth-google-callback",
"newAccounts": true, "newAccounts": true,
"clientid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", "clientid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxx" "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxx"
}, },
"github": { "github": {
"__callbackurl": "https://server/auth-github-callback", "_callbackurl": "https://server/auth-github-callback",
"newAccounts": true, "newAccounts": true,
"clientid": "xxxxxxxxxxxxxxxxxxxxxxx", "clientid": "xxxxxxxxxxxxxxxxxxxxxxx",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}, },
"reddit": { "reddit": {
"__callbackurl": "https://server/auth-reddit-callback", "_callbackurl": "https://server/auth-reddit-callback",
"newAccounts": true, "newAccounts": true,
"clientid": "xxxxxxxxxxxxxxxxxxxxxxx", "clientid": "xxxxxxxxxxxxxxxxxxxxxxx",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}, },
"azure": { "azure": {
"__callbackurl": "https://server/auth-azure-callback", "_callbackurl": "https://server/auth-azure-callback",
"newAccounts": true, "newAccounts": true,
"clientid": "00000000-0000-0000-0000-000000000000", "clientid": "00000000-0000-0000-0000-000000000000",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tenantid": "00000000-0000-0000-0000-000000000000" "tenantid": "00000000-0000-0000-0000-000000000000"
}, },
"jumpcloud": { "jumpcloud": {
"__callbackurl": "https://server/auth-jumpcloud-callback", "_callbackurl": "https://server/auth-jumpcloud-callback",
"newAccounts": true, "newAccounts": true,
"entityid": "meshcentral", "entityid": "meshcentral",
"idpurl": "https://sso.jumpcloud.com/saml2/saml2", "idpurl": "https://sso.jumpcloud.com/saml2/saml2",
"cert": "jumpcloud-saml.pem" "cert": "jumpcloud-saml.pem"
}, },
"saml": { "saml": {
"__callbackurl": "https://server/auth-saml-callback", "_callbackurl": "https://server/auth-saml-callback",
"newAccounts": true, "newAccounts": true,
"entityid": "meshcentral", "entityid": "meshcentral",
"idpurl": "https://server/saml2", "idpurl": "https://server/saml2",