diff --git a/meshuser.js b/meshuser.js index 7f1fd239..e0b8b66e 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1997,8 +1997,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Validate and change email if (edituserdomain.usernameisemail !== true) { - if (common.validateString(command.email, 1, 1024) && (chguser.email != command.email)) { - if (command.email == '') { delete chguser.email; } else { chguser.email = command.email.toLowerCase(); } + if (common.validateString(command.email, 0, 1024) && (chguser.email != command.email)) { + if (command.email == '') { command.emailVerified = false; delete chguser.email; } else { chguser.email = command.email.toLowerCase(); } change = 1; } } diff --git a/views/default.handlebars b/views/default.handlebars index 0fc0bf6b..993d38da 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -12026,11 +12026,13 @@ if (user.name.toLowerCase() != user._id.split('/')[2]) { x += addDeviceAttribute("User Identifier", EscapeHtml(user._id.split('/')[2])); } } + var emailLink = ''; + if (user.email) { emailLink = ' '; } if (((user.siteadmin != 0xFFFFFFFF) || (userinfo.siteadmin == 0xFFFFFFFF))) { // If we are not site admin, we can't change a admin email or real name - x += addDeviceAttribute("Email", everify + email + ' ' + ' '); + x += addDeviceAttribute("Email", everify + email + emailLink + ' '); x += addDeviceAttribute("Real Name", realname + ' '); } else { - x += addDeviceAttribute("Email", everify + email + ' '); + x += addDeviceAttribute("Email", everify + email + emailLink); x += addDeviceAttribute("Real Name", realname); } @@ -12185,7 +12187,7 @@ // Perform validation on the user's email change dialog box function p30validateEmail() { var v = Q('dp30email').value, x = v.split('@'); - x = (x.length == 2) && (x[0].length > 0) && (x[1].split('.').length > 1) && (x[1].length > 2) && (v.length < 1024) && ((v != userinfo.email) || ((serverinfo.emailcheck == true) && (Q('dp30verified').value != (userinfo.emailVerified?1:0)))); + x = (v.length == 0) || ((x.length == 2) && (x[0].length > 0) && (x[1].split('.').length > 1) && (x[1].length > 2) && (v.length < 1024) && ((v != userinfo.email) || ((serverinfo.emailcheck == true) && (Q('dp30verified').value != (userinfo.emailVerified?1:0))))); QE('idx_dlgOkButton', x); }