Skip to content

Commit c59d4f6

Browse files
yuzehRafael Santos
authored andcommitted
don't serve null authData values (parse-community#2320)
1 parent 8455c97 commit c59d4f6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spec/ParseUser.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,7 @@ describe('Parse.User testing', () => {
22912291
},
22922292
json: {
22932293
authData: {anonymous: null},
2294-
user: 'user',
2294+
username: 'user',
22952295
password: 'password',
22962296
}
22972297
}, (err, res, body) => {

src/RestQuery.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,17 @@ RestQuery.prototype.runFind = function() {
394394
if (this.className === '_User') {
395395
for (var result of results) {
396396
delete result.password;
397+
398+
if (result.authData) {
399+
Object.keys(result.authData).forEach((provider) => {
400+
if (result.authData[provider] === null) {
401+
delete result.authData[provider];
402+
}
403+
});
404+
if (Object.keys(result.authData).length == 0) {
405+
delete result.authData;
406+
}
407+
}
397408
}
398409
}
399410

0 commit comments

Comments
 (0)