Skip to content

Commit 7589da0

Browse files
committed
Notes
1 parent fc1cdd4 commit 7589da0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

spec/ParseUser.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,4 +2273,26 @@ describe('Parse.User testing', () => {
22732273
});
22742274
});
22752275

2276+
it('should not allow you to sign up with facebook twice (regression test for #1488)', done => {
2277+
const signUpPromise1 = Parse.FacebookUtils.logIn({
2278+
id: "8675309",
2279+
access_token: "jenny",
2280+
expiration_date: new Date().toJSON()
2281+
}).;st signUpPromise2 = Parse.FacebookUtils.logIn({
2282+
id: "8675309",
2283+
access_token: "jenny",
2284+
expiration_date: new Date().toJSON()
2285+
});
2286+
Promise.all([signUpPromise1, signUpPromise2]).then(() => {
2287+
new Parse.Query(Parse.User)
2288+
.find({ useMasterKey: true })
2289+
.then(allUsers => {
2290+
expect(allUsers.length).toEqual(1);
2291+
done();
2292+
});
2293+
}, e => {
2294+
console.log(e);
2295+
done();
2296+
})
2297+
});
22762298
});

src/RestWrite.js

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

366366
}).then(() => {
367367
// Check for username uniqueness
368+
//TODO: use a unique index on usernames to check for uniqueness to avoid race conditions
369+
//TODO: use a unique index on auth data to fix issue #1488
368370
if (!this.data.username) {
369371
if (!this.query) {
370372
this.data.username = cryptoUtils.randomString(25);

0 commit comments

Comments
 (0)