diff --git a/server/handlers/chat.js b/server/handlers/chat.js index 9e56e4a5..5628a504 100644 --- a/server/handlers/chat.js +++ b/server/handlers/chat.js @@ -170,6 +170,7 @@ function namechange(data, guid, socket, tried, callback) { data.password = pass; new_password = false; if(name == "" || pass == "") { + if(typeof(callback) == "function") callback(); return; } } else { @@ -185,7 +186,9 @@ function namechange(data, guid, socket, tried, callback) { new_password = Functions.decrypt_string(data.new_password); } } + if(name == "") { + if(typeof(callback) == "function") callback(); return; } var password = Functions.decrypt_string(pw); @@ -194,6 +197,7 @@ function namechange(data, guid, socket, tried, callback) { var icon = false; if(docs.length == 0) { if(new_password) { + if(typeof(callback) == "function") callback(); return; } accepted_password = true; diff --git a/server/handlers/functions.js b/server/handlers/functions.js index 5c752a48..a586444b 100644 --- a/server/handlers/functions.js +++ b/server/handlers/functions.js @@ -115,8 +115,10 @@ function get_short_id(socket) { function check_inlist(coll, guid, socket, offline, callback) { - - if(coll == undefined) return; + if(coll == undefined) { + if(typeof(callback) == "function") callback(); + return; + } //coll = coll.replace(/ /g,''); if(!offline && coll != undefined){ db.collection("connected_users").update({"_id": coll}, {$addToSet:{users: guid}}, {upsert: true}, function(err, updated) {