Skip to content

Commit 6a05a94

Browse files
committed
Notes
1 parent ab827e3 commit 6a05a94

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
@@ -2347,4 +2347,27 @@ describe('Parse.User testing', () => {
23472347
done();
23482348
});
23492349
});
2350+
2351+
it('should not allow you to sign up with facebook twice (regression test for #1488)', done => {
2352+
const signUpPromise1 = Parse.FacebookUtils.logIn({
2353+
id: "8675309",
2354+
access_token: "jenny",
2355+
expiration_date: new Date().toJSON()
2356+
}).;st signUpPromise2 = Parse.FacebookUtils.logIn({
2357+
id: "8675309",
2358+
access_token: "jenny",
2359+
expiration_date: new Date().toJSON()
2360+
});
2361+
Promise.all([signUpPromise1, signUpPromise2]).then(() => {
2362+
new Parse.Query(Parse.User)
2363+
.find({ useMasterKey: true })
2364+
.then(allUsers => {
2365+
expect(allUsers.length).toEqual(1);
2366+
done();
2367+
});
2368+
}, e => {
2369+
console.log(e);
2370+
done();
2371+
})
2372+
});
23502373
});

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)