mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added new account invitation system.
This commit is contained in:
parent
7292fa116b
commit
bbb98c6c6d
5 changed files with 51 additions and 9 deletions
|
@ -7365,8 +7365,12 @@
|
|||
x += addHtmlValue('Email', '<input id=p4email maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
|
||||
x += addHtmlValue('Password', '<input id=p4pass1 type=password maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
|
||||
x += addHtmlValue('Password', '<input id=p4pass2 type=password maxlength=256 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
|
||||
x += '<div><input id=p4resetNextLogin type=checkbox />Force password reset on next login.</div>';
|
||||
if (serverinfo.emailcheck) { x += '<div><input id=p4verifiedEmail type=checkbox />Email is verified.</div>'; }
|
||||
x += '<div><input id=p4randomPassword onchange=showCreateNewAccountDialogValidate() type=checkbox />Randomize the password.</div>';
|
||||
x += '<div><input id=p4resetNextLogin onchange=showCreateNewAccountDialogValidate() type=checkbox />Force password reset on next login.</div>';
|
||||
if (serverinfo.emailcheck) {
|
||||
x += '<div><input id=p4verifiedEmail onchange=showCreateNewAccountDialogValidate() type=checkbox />Email is verified.</div>';
|
||||
x += '<div><input id=p4invitationEmail type=checkbox />Send invitation email.</div>';
|
||||
}
|
||||
|
||||
if (passRequirements) {
|
||||
var r = [], rc = 0;
|
||||
|
@ -7380,18 +7384,31 @@
|
|||
}
|
||||
|
||||
function showCreateNewAccountDialogValidate(x) {
|
||||
if ((x == null) && (Q('p4email').value.length > 0) && (validateEmail(Q('p4email').value)) == false) { QE('idx_dlgOkButton', false); return; }
|
||||
var ve = validateEmail(Q('p4email').value);
|
||||
if (serverinfo.emailcheck) {
|
||||
QE('p4verifiedEmail', ve);
|
||||
QE('p4invitationEmail', ve && Q('p4resetNextLogin').checked && Q('p4verifiedEmail').checked);
|
||||
if (ve == false) { Q('p4verifiedEmail').checked = false; }
|
||||
if ((Q('p4resetNextLogin').checked == false) || (Q('p4verifiedEmail').checked == false)) { Q('p4invitationEmail').checked = false; }
|
||||
}
|
||||
QE('p4pass1', !Q('p4randomPassword').checked);
|
||||
QE('p4pass2', !Q('p4randomPassword').checked);
|
||||
|
||||
if ((x == null) && (Q('p4email').value.length > 0) && (ve == false)) { QE('idx_dlgOkButton', false); return; }
|
||||
var ok = true;
|
||||
if ((features & 0x200000) == 0) { ok &= (!Q('p4name') || ((Q('p4name').value.length > 0) && (Q('p4name').value.indexOf(' ') == -1))); }
|
||||
ok &= (Q('p4pass1').value.length > 0 && Q('p4pass1').value == Q('p4pass2').value && checkPasswordRequirements(Q('p4pass1').value, passRequirements));
|
||||
if (Q('p4randomPassword').checked == false) { ok &= (Q('p4pass1').value.length > 0 && Q('p4pass1').value == Q('p4pass2').value && checkPasswordRequirements(Q('p4pass1').value, passRequirements)); }
|
||||
if (ok && passRequirements) { if (checkPasswordRequirements(Q('p4pass1').value, passRequirements) == false) { ok = false; } }
|
||||
QE('idx_dlgOkButton', ok);
|
||||
}
|
||||
|
||||
function showCreateNewAccountDialogEx() {
|
||||
var username = ((features & 0x200000) == 0) ? Q('p4name').value : Q('p4email').value;
|
||||
var x = { action: 'adduser', username: username, email: Q('p4email').value, pass: Q('p4pass1').value, resetNextLogin: Q('p4resetNextLogin').checked };
|
||||
if (serverinfo.emailcheck) { x.emailVerified = Q('p4verifiedEmail').checked; }
|
||||
var x = { action: 'adduser', username: username, email: Q('p4email').value, pass: Q('p4pass1').value, resetNextLogin: Q('p4resetNextLogin').checked, randomPassword: Q('p4randomPassword').checked };
|
||||
if (serverinfo.emailcheck) {
|
||||
x.emailVerified = Q('p4verifiedEmail').checked;
|
||||
x.emailInvitation = Q('p4invitationEmail').checked;
|
||||
}
|
||||
meshserver.send(x);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue