Skip to content

Commit b7d2f88

Browse files
committed
Notes
1 parent e60901d commit b7d2f88

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

spec/ParseUser.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,4 +2407,27 @@ describe('Parse.User testing', () => {
24072407
})
24082408
});
24092409
})
2410+
2411+
it('should not allow you to sign up with facebook twice (regression test for #1488)', done => {
2412+
const signUpPromise1 = Parse.FacebookUtils.logIn({
2413+
id: "8675309",
2414+
access_token: "jenny",
2415+
expiration_date: new Date().toJSON()
2416+
}).;st signUpPromise2 = Parse.FacebookUtils.logIn({
2417+
id: "8675309",
2418+
access_token: "jenny",
2419+
expiration_date: new Date().toJSON()
2420+
});
2421+
Promise.all([signUpPromise1, signUpPromise2]).then(() => {
2422+
new Parse.Query(Parse.User)
2423+
.find({ useMasterKey: true })
2424+
.then(allUsers => {
2425+
expect(allUsers.length).toEqual(1);
2426+
done();
2427+
});
2428+
}, e => {
2429+
console.log(e);
2430+
done();
2431+
})
2432+
});
24102433
});

src/RestWrite.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ RestWrite.prototype.transformUser = function() {
338338

339339
}).then(() => {
340340
// Check for username uniqueness
341+
//TODO: use a unique index on usernames to check for uniqueness to avoid race conditions
342+
//TODO: use a unique index on auth data to fix issue #1488
341343
if (!this.data.username) {
342344
if (!this.query) {
343345
this.data.username = cryptoUtils.randomString(25);

0 commit comments

Comments
 (0)