Skip to content

Commit

Permalink
tidy json account settings response, closes #111
Browse files Browse the repository at this point in the history
  • Loading branch information
jedireza committed Jan 26, 2014
1 parent 44560e3 commit 8c436f3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions views/account/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ exports.update = function(req, res, next){
req.body.zip
]
};
var options = { select: 'name company phone zip' };

req.app.db.models.Account.findByIdAndUpdate(req.user.roles.account.id, fieldsToSet, function(err, account) {
req.app.db.models.Account.findByIdAndUpdate(req.user.roles.account.id, fieldsToSet, options, function(err, account) {
if (err) {
return workflow.emit('exception', err);
}
Expand Down Expand Up @@ -280,8 +281,9 @@ exports.identity = function(req, res, next){
req.body.email
]
};
var options = { select: 'username email twitter.id github.id facebook.id' };

req.app.db.models.User.findByIdAndUpdate(req.user.id, fieldsToSet, function(err, user) {
req.app.db.models.User.findByIdAndUpdate(req.user.id, fieldsToSet, options, function(err, user) {
if (err) {
return workflow.emit('exception', err);
}
Expand Down Expand Up @@ -386,7 +388,6 @@ exports.password = function(req, res, next){
return workflow.emit('exception', err);
}

workflow.outcome.user = user;
workflow.outcome.newPassword = '';
workflow.outcome.confirm = '';
workflow.emit('response');
Expand Down

0 comments on commit 8c436f3

Please sign in to comment.