fix email in use meshctrl reply #6036

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Apr 18, 2024 at 20:48 UTC 1747ff755025f2aae96b06d58e5632de4fbd534b
1 file changed +8 -4
meshuser.js
+8 -4
@@ -5792,10 +5792,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
5792 }
5793 return;
5794 }
5795 -
5796 - for(var x in parent.users) {
5797 - if(parent.users[x].email==command.email){
5798 - displayNotificationMessage("Email address already in use", "New Account", "ServerNotify");
5795 + for (var x in parent.users) {
5796 + if (parent.users[x].email == command.email){
5797 + if (command.responseid != null) {
5798 + obj.send({ action: 'adduser', responseid: command.responseid, result: "Email address already in use", msgid: errid });
5799 + } else {
5800 + // Send error back, user not found.
5801 + displayNotificationMessage("Email address already in use", "New Account", 'ServerNotify', 1, errid, args);
5802 + }
5803 return;
5804 }
5805 }