From 1b83d9c6213abc0ffccbd7d45ba52233faac6807 Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Fri, 26 Feb 2016 05:05:15 -0800 Subject: [PATCH] Fix for #413 - support empty authData on signup --- spec/ParseUser.spec.js | 12 +++++++++++- src/RestWrite.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/spec/ParseUser.spec.js b/spec/ParseUser.spec.js index 0e5f3a78ee..424e4207f0 100644 --- a/spec/ParseUser.spec.js +++ b/spec/ParseUser.spec.js @@ -1720,7 +1720,17 @@ describe('Parse.User testing', () => { expect(e.code).toEqual(Parse.Error.SESSION_MISSING); done(); }); - }) + }); + + it('support user/password signup with empty authData block', (done) => { + // The android SDK can send an empty authData object along with username and password. + Parse.User.signUp('artof', 'thedeal', { authData: {} }).then((user) => { + done(); + }, (error) => { + fail('Signup should have succeeded.'); + done(); + }); + }); }); diff --git a/src/RestWrite.js b/src/RestWrite.js index d23912a775..c5551e7e63 100644 --- a/src/RestWrite.js +++ b/src/RestWrite.js @@ -176,7 +176,7 @@ RestWrite.prototype.validateAuthData = function() { } } - if (!this.data.authData) { + if (!this.data.authData || !Object.keys(this.data.authData).length) { return; }