File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2273,4 +2273,26 @@ describe('Parse.User testing', () => {
2273
2273
} ) ;
2274
2274
} ) ;
2275
2275
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
+ } ) ;
2276
2298
} ) ;
Original file line number Diff line number Diff line change @@ -365,6 +365,8 @@ RestWrite.prototype.transformUser = function() {
365
365
366
366
} ) . then ( ( ) => {
367
367
// 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
368
370
if ( ! this . data . username ) {
369
371
if ( ! this . query ) {
370
372
this . data . username = cryptoUtils . randomString ( 25 ) ;
You can’t perform that action at this time.
0 commit comments