[TASK] Minor api fixes.
Altered whitespace, comments and replaced "err" with "error" in JSON responses.
This commit is contained in:
parent
0c0aacd4c3
commit
9e154221a9
2
app.js
2
app.js
|
@ -60,7 +60,7 @@ app.use(function(req, res, next) {
|
|||
"lastActivity": new Date().toString()
|
||||
};
|
||||
}
|
||||
console.log(["Session Data", req.session.data]);
|
||||
//console.log(["Session Data", req.session.data]);
|
||||
next();
|
||||
});
|
||||
|
||||
|
|
|
@ -43,13 +43,13 @@ var constructor = function(db) {
|
|||
return;
|
||||
}
|
||||
//check if user exists
|
||||
db.get(params.username, function (err, doc) {
|
||||
console.log(["dbgetuser", arguments]);
|
||||
db.get(params.username, function(err, doc) {
|
||||
if(!err && doc.type == "user") {
|
||||
var userDocument = doc;
|
||||
//user exists, verify password
|
||||
scrypt.verifyHash(userDocument.auth, params.password, function(err, match) {
|
||||
if(err || match == false) {
|
||||
//password not correct
|
||||
res.send(200, JSON.stringify({
|
||||
"success": false,
|
||||
"error": "Invalid login credentials!"
|
||||
|
|
|
@ -67,7 +67,7 @@ var constructor = function(db) {
|
|||
if(req.session.data.login == false) {
|
||||
res.send(200, JSON.stringify({
|
||||
"success": false,
|
||||
"err": "You are not logged in!"
|
||||
"error": "You are not logged in!"
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ var constructor = function(db) {
|
|||
console.log(err);
|
||||
res.send(200, JSON.stringify({
|
||||
"success": false,
|
||||
"err": "Something went wrong updating the user document!"
|
||||
"error": "Something went wrong updating the user document!"
|
||||
}));
|
||||
} else {
|
||||
db.get(req.session.data.user._id, function(err, result) {
|
||||
|
@ -93,7 +93,7 @@ var constructor = function(db) {
|
|||
console.log(err);
|
||||
res.send(200, JSON.stringify({
|
||||
"success": false,
|
||||
"err": "Something went wrong re-reading the user document!"
|
||||
"error": "Something went wrong re-reading the user document!"
|
||||
}));
|
||||
} else {
|
||||
req.session.data.user = result;
|
||||
|
|
Loading…
Reference in New Issue