diff options
| author | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-22 05:26:45 +0000 |
|---|---|---|
| committer | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-22 05:26:45 +0000 |
| commit | e12c4639ce6ad2bd1333ee0f0ae07f12c1db2e73 (patch) | |
| tree | 29c7f762d59b516999906d45858d501d3cb4d49c | |
| parent | 3633294462061923979bd97bbd27127b29e28468 (diff) | |
| parent | 070153f4555e16d44e538e305f85eb0552e9044e (diff) | |
merged
| -rw-r--r-- | node_simple.js | 8 | ||||
| -rw-r--r-- | routes/index.js | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/node_simple.js b/node_simple.js index 5d40b11..b2321f2 100644 --- a/node_simple.js +++ b/node_simple.js @@ -130,19 +130,20 @@ exports.add_user = function (fields, callbackUser) { var users = db.collection('users'); var logins = db.collection('logins'); - var error = false; +<<<<<<< HEAD + // Add users, and login through callbacks users.insertOne( user_data, function (err) { if (err) { callbackUser(false, true, "Error : User has not been added."); } - else { + else {// user insert successfull logins.insertOne( login_data, function (err) { if (err) { callbackUser(false, true, "Error : User has not been added."); } - else { + else {// login insert successfull callbackUser(true, false, "User has been added."); } }); @@ -150,6 +151,7 @@ exports.add_user = function (fields, callbackUser) { }); db.close(); + }) .catch(function (err) { callbackUser(false, true, "Unable to connect."); diff --git a/routes/index.js b/routes/index.js index f44b175..b6db0ca 100644 --- a/routes/index.js +++ b/routes/index.js @@ -211,7 +211,6 @@ function toProperCase(string) { return string.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); } - /* Takes an input string delimited by commas, will split by comma and trim white * spaces. Consider callback. */ |
