Added more text to clarify that MeshCentral needs to be offline for --resetaccount, --createaccount, --adminaccount to work.

Ylian Saint-Hilaire committed Aug 30, 2022 at 14:41 UTC 2a201630e934b985303589fc4a5d0f2de873e153
1 file changed +3 -3
meshcentral.js
+3 -3
@@ -842,7 +842,7 @@ function CreateMeshCentralServer(config, args) {
842 if (hashpasssplit.length != 2) { console.log("Invalid hashed password."); process.exit(); return; }
843 user.salt = hashpasssplit[0];
844 user.hash = hashpasssplit[1];
845 - obj.db.Set(user, function () { console.log("Done."); process.exit(); return; });
845 + obj.db.Set(user, function () { console.log("Done. This command will only work if MeshCentral is stopped."); process.exit(); return; });
846 } else {
847 // Hash the password and create the account.
848 require('./pass').hash(obj.args.pass, function (err, salt, hash, tag) { if (err) { console.log("Unable create account password: " + err); process.exit(); return; } user.salt = salt; user.hash = hash; obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); }, 0);
@@ -866,7 +866,7 @@ function CreateMeshCentralServer(config, args) {
866 if (hashpasssplit.length != 2) { console.log("Invalid hashed password."); process.exit(); return; }
867 user.salt = hashpasssplit[0];
868 user.hash = hashpasssplit[1];
869 - obj.db.Set(user, function () { console.log("Done."); process.exit(); return; });
869 + obj.db.Set(user, function () { console.log("Done. This command will only work if MeshCentral is stopped."); process.exit(); return; });
870 } else {
871 // Hash the password and reset the account.
872 require('./pass').hash(String(obj.args.pass), user.salt, function (err, hash, tag) { if (err) { console.log("Unable to reset password: " + err); process.exit(); return; } user.hash = hash; obj.db.Set(user, function () { console.log("Done."); process.exit(); return; }); }, 0);
@@ -883,7 +883,7 @@ function CreateMeshCentralServer(config, args) {
883 if (err != null) { console.log("Database error: " + err); process.exit(); return; }
884 if ((docs == null) || (docs.length == 0)) { console.log("Unknown userid, usage: --adminaccount [userid] --domain (domain)."); process.exit(); return; }
885 docs[0].siteadmin = 0xFFFFFFFF; // Set user as site administrator
886 - obj.db.Set(docs[0], function () { console.log("Done."); process.exit(); return; });
886 + obj.db.Set(docs[0], function () { console.log("Done. This command will only work if MeshCentral is stopped."); process.exit(); return; });
887 });
888 return;
889 }