File tree 2 files changed +25
-0
lines changed 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2407,4 +2407,27 @@ describe('Parse.User testing', () => {
2407
2407
} )
2408
2408
} ) ;
2409
2409
} )
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
+ } ) ;
2410
2433
} ) ;
Original file line number Diff line number Diff line change @@ -338,6 +338,8 @@ RestWrite.prototype.transformUser = function() {
338
338
339
339
} ) . then ( ( ) => {
340
340
// 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
341
343
if ( ! this . data . username ) {
342
344
if ( ! this . query ) {
343
345
this . data . username = cryptoUtils . randomString ( 25 ) ;
You can’t perform that action at this time.
0 commit comments