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 @@ -2347,4 +2347,27 @@ describe('Parse.User testing', () => {
2347
2347
done ( ) ;
2348
2348
} ) ;
2349
2349
} ) ;
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
+ } ) ;
2350
2373
} ) ;
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