Fixed password change dialog box.

This commit is contained in:
Ylian Saint-Hilaire 2019-05-04 13:20:25 -07:00
parent d8548920bc
commit 5b21b28b15
5 changed files with 17 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.3.3-s", "version": "0.3.3-t",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",
@ -36,7 +36,6 @@
"express-handlebars": "^3.0.0", "express-handlebars": "^3.0.0",
"express-ws": "^4.0.0", "express-ws": "^4.0.0",
"ipcheck": "^0.1.0", "ipcheck": "^0.1.0",
"ldapauth-fork": "^4.2.0",
"meshcentral": "*", "meshcentral": "*",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"multiparty": "^4.2.1", "multiparty": "^4.2.1",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1153,17 +1153,18 @@
function account_showChangePassword() { function account_showChangePassword() {
if (xxdialogMode) return; if (xxdialogMode) return;
var x = "<form action='" + domainUrl + "changepassword' method=post><table style=margin-left:10px><tr>"; var x = "<form action='" + domainUrl + "changepassword' method=post><table style=margin-left:10px>";
x += "<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>"; x += "<tr><td align=right>Old Password:</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td></tr>";
x += "</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td>"; x += "<tr><td align=right>New Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td></tr>";
if (features & 0x00010000) { x += "</tr><tr><td align=right>Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>"; } x += "<tr><td align=right>New Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /></td></tr>";
x += '</tr></table><div style=padding:10px;margin-bottom:4px>'; if (features & 0x00010000) { x += "<tr><td align=right>Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td></tr>"; }
x += '</table><div style=padding:10px;margin-bottom:4px>';
x += '<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>'; x += '<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>';
x += '<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>'; x += '<input id=account_dlgOkButton type=submit value=OK style="float:right;width:80px" onclick=dialogclose(1)>';
x += '</div><br /></form>'; x += '</div><br /></form>';
setDialogMode(2, "Change Password", 0, null, x); setDialogMode(2, "Change Password", 0, null, x);
account_validateNewPassword(); account_validateNewPassword();
Q('apassword1').focus(); Q('apassword0').focus();
} }
function account_createMesh() { function account_createMesh() {
@ -1200,7 +1201,8 @@
} }
function account_validateNewPassword() { function account_validateNewPassword() {
var r = '', ok = (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value); var r = '', ok = (Q('apassword0').value.length > 0) && (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value) && (Q('apassword0').value != Q('apassword1').value);
if ((features & 0x00010000) && (Q('apasswordhint').value == Q('apassword1').value)) { ok = false; }
if (Q('apassword1').value != '') { if (Q('apassword1').value != '') {
if (passRequirements == null || passRequirements == '') { if (passRequirements == null || passRequirements == '') {
// No password requirements, display password strength // No password requirements, display password strength

View File

@ -1253,7 +1253,6 @@
function addLetterS(x) { return (x > 1) ? 's' : ''; } function addLetterS(x) { return (x > 1) ? 's' : ''; }
function onMessage(server, message) { function onMessage(server, message) {
console.log(message);
switch (message.action) { switch (message.action) {
case 'serverstats': { case 'serverstats': {
updateGeneralServerStats(message); updateGeneralServerStats(message);
@ -5837,7 +5836,9 @@
function account_showChangePassword() { function account_showChangePassword() {
if (xxdialogMode) return; if (xxdialogMode) return;
var x = "Change your account password by entering the old password and new password twice in the boxes below. Password hint can be used but is not recommanded.<br /><br />"; var x = "Change your account password by entering the old password and new password twice in the boxes below.";
if (features & 0x00010000) { " Password hint can be used but is not recommanded."; }
x += "<br /><br />";;
//x += "<form action='" + domainUrl + "changepassword' method=post>"; //x += "<form action='" + domainUrl + "changepassword' method=post>";
x += "<table style=margin-left:60px>"; x += "<table style=margin-left:60px>";
x += "<tr><td align=right>Old password:</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>"; x += "<tr><td align=right>Old password:</td><td><input id=apassword0 type=password name=apassword0 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() onkeydown=account_validateNewPassword() /> <b></b></td></tr>";
@ -5903,7 +5904,8 @@
} }
function account_validateNewPassword() { function account_validateNewPassword() {
var r = '', ok = (Q('apassword0').value.length > 0) && (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value) && (Q('apassword0').value != Q('apassword1').value) && (Q('apasswordhint').value != Q('apassword1').value); var r = '', ok = (Q('apassword0').value.length > 0) && (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value) && (Q('apassword0').value != Q('apassword1').value);
if ((features & 0x00010000) && (Q('apasswordhint').value == Q('apassword1').value)) { ok = false; }
if (Q('apassword1').value != '') { if (Q('apassword1').value != '') {
if (passRequirements == null || passRequirements == '') { if (passRequirements == null || passRequirements == '') {
// No password requirements, display password strength // No password requirements, display password strength