Skip to content

Commit

Permalink
don't serve null authData values (parse-community#2320)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzeh authored and Rafael Santos committed Mar 15, 2017
1 parent 8455c97 commit c59d4f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ describe('Parse.User testing', () => {
},
json: {
authData: {anonymous: null},
user: 'user',
username: 'user',
password: 'password',
}
}, (err, res, body) => {
Expand Down
11 changes: 11 additions & 0 deletions src/RestQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,17 @@ RestQuery.prototype.runFind = function() {
if (this.className === '_User') {
for (var result of results) {
delete result.password;

if (result.authData) {
Object.keys(result.authData).forEach((provider) => {
if (result.authData[provider] === null) {
delete result.authData[provider];
}
});
if (Object.keys(result.authData).length == 0) {
delete result.authData;
}
}
}
}

Expand Down

0 comments on commit c59d4f6

Please sign in to comment.