Fixed email validation on admin account creation.

This commit is contained in:
Ylian Saint-Hilaire 2020-04-05 18:13:47 -07:00
parent df18c598ec
commit f5c5ebaf5e
3 changed files with 323 additions and 318 deletions

View File

@ -1492,7 +1492,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
// Handle any errors // Handle any errors
if (err != null) { if (err != null) {
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'adduser', responseid: command.responseid, result: err })); } catch (ex) { } } if (command.responseid != null) {
try { ws.send(JSON.stringify({ action: 'adduser', responseid: command.responseid, result: err })); } catch (ex) { }
} else {
// Send error back, user not found.
displayNotificationMessage(err, 'New Account', 'ServerNotify');
}
break; break;
} }

File diff suppressed because it is too large Load Diff

View File

@ -9732,10 +9732,9 @@
if ((features & 0x200000) == 0) { Q('p4name').focus(); } else { Q('p4email').focus(); } if ((features & 0x200000) == 0) { Q('p4name').focus(); } else { Q('p4email').focus(); }
} }
function showCreateNewAccountDialogValidate(x) { function showCreateNewAccountDialogValidate() {
var ve = true; var ve = validateEmail(Q('p4email').value);
if (serverinfo.emailcheck) { if (serverinfo.emailcheck) {
ve = validateEmail(Q('p4email').value);
QE('p4verifiedEmail', ve); QE('p4verifiedEmail', ve);
QE('p4invitationEmail', ve && Q('p4resetNextLogin').checked && Q('p4verifiedEmail').checked); QE('p4invitationEmail', ve && Q('p4resetNextLogin').checked && Q('p4verifiedEmail').checked);
if (ve == false) { Q('p4verifiedEmail').checked = false; } if (ve == false) { Q('p4verifiedEmail').checked = false; }
@ -9743,8 +9742,8 @@
} }
QE('p4pass1', !Q('p4randomPassword').checked); QE('p4pass1', !Q('p4randomPassword').checked);
QE('p4pass2', !Q('p4randomPassword').checked); QE('p4pass2', !Q('p4randomPassword').checked);
if (ve == false) { QE('idx_dlgOkButton', false); return; }
if ((x == null) && (Q('p4email').value.length > 0) && (ve == false)) { QE('idx_dlgOkButton', false); return; }
var ok = true; var ok = true;
if ((features & 0x200000) == 0) { ok &= (!Q('p4name') || ((Q('p4name').value.length > 0) && (Q('p4name').value.indexOf(' ') == -1))); } // Username is not email address if ((features & 0x200000) == 0) { ok &= (!Q('p4name') || ((Q('p4name').value.length > 0) && (Q('p4name').value.indexOf(' ') == -1))); } // Username is not email address
if (Q('p4randomPassword').checked == false) { 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)); }