mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 06:35:54 -05:00
Added verified email argument to MeshCtrl.
This commit is contained in:
parent
8ca9a46eaf
commit
b8b2c0f77b
@ -133,6 +133,7 @@ if (args['_'].length == 0) {
|
|||||||
console.log(" --randompass - Create account with a random password.");
|
console.log(" --randompass - Create account with a random password.");
|
||||||
console.log("\r\nOptional arguments:\r\n");
|
console.log("\r\nOptional arguments:\r\n");
|
||||||
console.log(" --email [email] - New account email address.");
|
console.log(" --email [email] - New account email address.");
|
||||||
|
console.log(" --emailverified - New account email is verified.");
|
||||||
console.log(" --resetpass - Request password reset on next login.");
|
console.log(" --resetpass - Request password reset on next login.");
|
||||||
console.log(" --siteadmin - Create the account as full site administrator.");
|
console.log(" --siteadmin - Create the account as full site administrator.");
|
||||||
console.log(" --manageusers - Allow this account to manage server users.");
|
console.log(" --manageusers - Allow this account to manage server users.");
|
||||||
@ -290,7 +291,7 @@ function serverConnect() {
|
|||||||
if (args.notools) { siteadmin |= 128; }
|
if (args.notools) { siteadmin |= 128; }
|
||||||
if (args.randompass) { args.pass = getRandomAmtPassword(); }
|
if (args.randompass) { args.pass = getRandomAmtPassword(); }
|
||||||
var op = { action: 'adduser', username: args.user, pass: args.pass, responseid: 'meshctrl' };
|
var op = { action: 'adduser', username: args.user, pass: args.pass, responseid: 'meshctrl' };
|
||||||
if (args.email) { op.email = args.email; }
|
if (args.email) { op.email = args.email; if (args.emailverified) { op.emailVerified = true; } }
|
||||||
if (args.resetpass) { op.resetNextLogin = true; }
|
if (args.resetpass) { op.resetNextLogin = true; }
|
||||||
if (siteadmin != 0) { op.siteadmin = siteadmin; }
|
if (siteadmin != 0) { op.siteadmin = siteadmin; }
|
||||||
ws.send(JSON.stringify(op));
|
ws.send(JSON.stringify(op));
|
||||||
|
@ -1066,7 +1066,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
var newuserid = 'user/' + domain.id + '/' + command.users[i].user.toLowerCase();
|
var newuserid = 'user/' + domain.id + '/' + command.users[i].user.toLowerCase();
|
||||||
var newuser = { type: 'user', _id: newuserid, name: command.users[i].user, creation: Math.floor(Date.now() / 1000), domain: domain.id };
|
var newuser = { type: 'user', _id: newuserid, name: command.users[i].user, creation: Math.floor(Date.now() / 1000), domain: domain.id };
|
||||||
if (domain.newaccountsrights) { newuser.siteadmin = domain.newaccountsrights; }
|
if (domain.newaccountsrights) { newuser.siteadmin = domain.newaccountsrights; }
|
||||||
if (command.users[i].email != null) { newuser.email = command.users[i].email; } // Email
|
if (command.users[i].email != null) { newuser.email = command.users[i].email; if (command.users[i].emailVerified === true) { newuser.emailVerified = true; } } // Email
|
||||||
if (command.users[i].resetNextLogin === true) { newuser.passchange = -1; } else { newuser.passchange = Math.floor(Date.now() / 1000); }
|
if (command.users[i].resetNextLogin === true) { newuser.passchange = -1; } else { newuser.passchange = Math.floor(Date.now() / 1000); }
|
||||||
if ((command.users[i].groups != null) && (common.validateStrArray(command.users[i].groups, 1, 32))) { newuser.groups = command.users[i].groups; } // New account are automatically part of our groups.
|
if ((command.users[i].groups != null) && (common.validateStrArray(command.users[i].groups, 1, 32))) { newuser.groups = command.users[i].groups; } // New account are automatically part of our groups.
|
||||||
|
|
||||||
@ -1103,6 +1103,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
var err = null, newusername, newuserid;
|
var err = null, newusername, newuserid;
|
||||||
try {
|
try {
|
||||||
if ((user.siteadmin & 2) == 0) { err = 'Permission denied'; }
|
if ((user.siteadmin & 2) == 0) { err = 'Permission denied'; }
|
||||||
|
else if ((domain.auth == 'sspi') || (domain.auth == 'ldap')) { err = 'Unable to add user in this mode'; }
|
||||||
else if (common.validateUsername(command.username, 1, 64) == false) { err = 'Invalid username'; } // Username is between 1 and 64 characters, no spaces
|
else if (common.validateUsername(command.username, 1, 64) == false) { err = 'Invalid username'; } // Username is between 1 and 64 characters, no spaces
|
||||||
else if (common.validateString(command.pass, 1, 256) == false) { err = 'Invalid password'; } // Password is between 1 and 256 characters
|
else if (common.validateString(command.pass, 1, 256) == false) { err = 'Invalid password'; } // Password is between 1 and 256 characters
|
||||||
else if (command.username.indexOf('/') >= 0) { err = 'Invalid username'; } // Usernames can't have '/'
|
else if (command.username.indexOf('/') >= 0) { err = 'Invalid username'; } // Usernames can't have '/'
|
||||||
@ -1147,9 +1148,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
var newuser = { type: 'user', _id: newuserid, name: newusername, creation: Math.floor(Date.now() / 1000), domain: domain.id };
|
var newuser = { type: 'user', _id: newuserid, name: newusername, creation: Math.floor(Date.now() / 1000), domain: domain.id };
|
||||||
if (command.siteadmin != null) { newuser.siteadmin = command.siteadmin; }
|
if (command.siteadmin != null) { newuser.siteadmin = command.siteadmin; }
|
||||||
else if (domain.newaccountsrights) { newuser.siteadmin = domain.newaccountsrights; }
|
else if (domain.newaccountsrights) { newuser.siteadmin = domain.newaccountsrights; }
|
||||||
if (command.email != null) { newuser.email = command.email; } // Email
|
if (command.email != null) { newuser.email = command.email; if (command.emailVerified === true) { newuser.emailVerified = true; } } // Email
|
||||||
if (command.resetNextLogin === true) { newuser.passchange = -1; } else { newuser.passchange = Math.floor(Date.now() / 1000); }
|
if (command.resetNextLogin === true) { newuser.passchange = -1; } else { newuser.passchange = Math.floor(Date.now() / 1000); }
|
||||||
if ((user.groups != null) && (user.groups.length > 0)) { newuser.groups = user.groups; } // New account are automatically part of our groups.
|
|
||||||
parent.users[newuserid] = newuser;
|
parent.users[newuserid] = newuser;
|
||||||
|
|
||||||
// Create a user, generate a salt and hash the password
|
// Create a user, generate a salt and hash the password
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.3.7-a",
|
"version": "0.3.7-c",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
@ -7915,7 +7915,6 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this
|
|||||||
node.namel = node.name.toLowerCase();
|
node.namel = node.name.toLowerCase();
|
||||||
if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
|
if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
|
||||||
if (message.event.node.icon) { node.icon = message.event.node.icon; }
|
if (message.event.node.icon) { node.icon = message.event.node.icon; }
|
||||||
console.log(node);
|
|
||||||
|
|
||||||
// Web page update
|
// Web page update
|
||||||
masterUpdate(2 | 4 | 8 | 16);
|
masterUpdate(2 | 4 | 8 | 16);
|
||||||
|
Loading…
Reference in New Issue
Block a user