From c8839b59864486bae49aab173346836fee2ad5b6 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 26 Aug 2019 12:20:24 -0700 Subject: [PATCH] Added support for browsers that don't support cookies. --- meshuser.js | 4 +- package.json | 2 +- views/default-min.handlebars | 2 +- views/default-mobile.handlebars | 46 ++++++--- views/default.handlebars | 4 +- views/login-min.handlebars | 2 +- views/login-mobile-min.handlebars | 2 +- views/login-mobile.handlebars | 19 ++-- views/login.handlebars | 19 ++-- webserver.js | 157 +++++++++++++++++++----------- 10 files changed, 163 insertions(+), 94 deletions(-) diff --git a/meshuser.js b/meshuser.js index 4ca2dcc6..27269a60 100644 --- a/meshuser.js +++ b/meshuser.js @@ -872,7 +872,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Always lowercase the email address command.email = command.email.toLowerCase(); - if (parent.users[req.session.userid].email != command.email) { + if (obj.user.email != command.email) { // Check if this email is already validated on a different account db.GetUserWithVerifiedEmail(domain.id, command.email, function (err, docs) { if ((docs != null) && (docs.length > 0)) { @@ -914,7 +914,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Always lowercase the email address command.email = command.email.toLowerCase(); - if ((parent.parent.mailserver != null) && (parent.users[req.session.userid].email.toLowerCase() == command.email)) { + if ((parent.parent.mailserver != null) && (obj.user.email.toLowerCase() == command.email)) { // Send the verification email parent.parent.mailserver.sendAccountCheckMail(domain, user.name, user.email); } diff --git a/package.json b/package.json index af63a549..abeec045 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.0-g", + "version": "0.4.0-h", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index fc42dc2c..04fea34c 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index 2ef03d41..ce9e0fa5 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -1188,7 +1188,7 @@ function account_showDeleteAccount() { if (xxdialogMode) return; - var x = "
"; + var x = "
"; x += ""; x += ""; x += '
Password:
Password:
'; @@ -1200,20 +1200,33 @@ Q('apassword1').focus(); } + function account_showChangePassword() { - if (xxdialogMode) return; - var x = ""; - x += ""; - x += ""; - x += ""; - if (features & 0x00010000) { x += ""; } - x += '
Old Password:
New Password:
New Password:
Hint:
'; - x += ''; - x += ''; - x += '

'; - setDialogMode(2, "Change Password", 0, null, x); - account_validateNewPassword(); + if (xxdialogMode) return false; + var x = ""; + x += ""; + x += ""; + x += ""; + if (features & 0x00010000) { x += ""; } + x += '
Old password:
New password:
New password:
Password hint:
' + if (passRequirements) { + var r = [], rc = 0; + for (var i in passRequirements) { if ((i != 'reset') && (i != 'hint')) { r.push(i + ':' + passRequirements[i]); rc++; } } + if (rc > 0) { x += '
Requirements: ' + r.join(', ') + '.'; } + } + x += '
'; + setDialogMode(2, "Change Password", 3, account_showChangePasswordEx, x); Q('apassword0').focus(); + account_validateNewPassword(); + return false; + } + + function account_showChangePasswordEx() { + if (Q('apassword1').value == Q('apassword2').value) { + var r = { action: 'changepassword', oldpass: Q('apassword0').value, newpass: Q('apassword1').value }; + if (features & 0x00010000) { r.hint = Q('apasswordhint').value; } + meshserver.send(r); + } } function account_createMesh() { @@ -1256,15 +1269,16 @@ if (passRequirements == null || passRequirements == '') { // No password requirements, display password strength var passStrength = checkPasswordStrength(Q('apassword1').value); - if (passStrength >= 80) { r = ''; } else if (passStrength >= 60) { r = ''; } else { r = ''; } + if (passStrength >= 80) { r = 'Strong'; } else if (passStrength >= 60) { r = ''; } else { r = ''; } } else { // Password requirements provided, use that var passReq = checkPasswordRequirements(Q('apassword1').value, passRequirements); - if (passReq == false) { ok = false; r = '' } + if (passReq == false) { ok = false; r = 'Policy' } } } QH('dxPassWarn', r); - QE('account_dlgOkButton', ok); + //QE('account_dlgOkButton', ok); + QE('idx_dlgOkButton', ok); } // Return a password strength score diff --git a/views/default.handlebars b/views/default.handlebars index 196990bd..ee04e157 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -6469,7 +6469,7 @@ function account_showDeleteAccount() { if (xxdialogMode) return false; var x = "To delete this account, type in the account password in both boxes below and hit ok.

"; - x += "
"; + x += "
"; x += ""; x += ""; x += '
Password:
Password:

'; @@ -6486,7 +6486,7 @@ if (xxdialogMode) return false; 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 += "

";; + x += "

"; //x += ""; x += ""; x += ""; diff --git a/views/login-min.handlebars b/views/login-min.handlebars index ef4836f9..a1feed00 100644 --- a/views/login-min.handlebars +++ b/views/login-min.handlebars @@ -1 +1 @@ -{{{title}}} - Login
{{{title}}}
{{{title2}}}

Welcome

Old password:

\ No newline at end of file + {{{title}}} - Login
{{{title}}}
{{{title2}}}

Welcome


\ No newline at end of file diff --git a/views/login-mobile-min.handlebars b/views/login-mobile-min.handlebars index 96cf72df..b0740e78 100644 --- a/views/login-mobile-min.handlebars +++ b/views/login-mobile-min.handlebars @@ -1 +1 @@ - MeshCentral - Login
{{{title}}}
{{{title2}}}
\ No newline at end of file + MeshCentral - Login
{{{title}}}
{{{title2}}}
\ No newline at end of file diff --git a/views/login-mobile.handlebars b/views/login-mobile.handlebars index 966722f2..8d7fd12f 100644 --- a/views/login-mobile.handlebars +++ b/views/login-mobile.handlebars @@ -44,7 +44,8 @@