aboutsummaryrefslogtreecommitdiff
path: root/node_simple.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_simple.js')
-rw-r--r--node_simple.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/node_simple.js b/node_simple.js
index 99a187e..b2321f2 100644
--- a/node_simple.js
+++ b/node_simple.js
@@ -130,22 +130,27 @@ exports.add_user = function (fields, callbackUser) {
var users = db.collection('users');
var logins = db.collection('logins');
+<<<<<<< HEAD
// Add users, and login through callbacks
users.insertOne( user_data, function (err) {
- if(err){
- callbackUser(false, true, "Unable to add user.");
- }else { // user insert successfull
- logins.insertOne(login_data, function (err) {
- if (err) {
- callbackUser(false, true, "Login has not been added.");
- } else { // login insert successfull
- callbackUser(true, false, "User has been added.");
- db.close();
- }
- });
- }
+ if (err) {
+ callbackUser(false, true, "Error : User has not been added.");
+ }
+
+ else {// user insert successfull
+ logins.insertOne( login_data, function (err) {
+ if (err) {
+ callbackUser(false, true, "Error : User has not been added.");
+ }
+
+ else {// login insert successfull
+ callbackUser(true, false, "User has been added.");
+ }
+ });
+ }
});
+ db.close();
})
.catch(function (err) {