@@ -620,16 +620,23 @@ RestWrite.prototype._validateUserName = function() {
620
620
return Promise . resolve ( ) ;
621
621
}
622
622
/*
623
- Username's should be unique when compared case insensitively
623
+ Usernames should be unique when compared case insensitively
624
624
625
- User's should be able to make case sensitive usernames and
625
+ Users should be able to make case sensitive usernames and
626
626
login using the case they entered. I.e. 'Snoopy' should preclude
627
627
'snoopy' as a valid username.
628
628
629
- Users that use authentication adapters should enforce unique ids
630
- through a unique index on username. Failure to enforce through an index
631
- allows for a potential collision for adapter users (a low probability outcome)
632
- but more importantly will have poor performance on this validation.
629
+ However, authentication adapters require a looser check that takes
630
+ case into consideration when determining uniqueness.
631
+
632
+ The username field should have a unique index on the database as
633
+ Failure to enforce through an index allows for a potential collision
634
+ for adapter users (a low probability outcome) but more importantly
635
+ will have poor performance on this validation.
636
+
637
+ The check below has the potential to not allow a valid
638
+ username for an adapter other than anonymous, this should
639
+ be fixed.
633
640
*/
634
641
return this . config . database
635
642
. find (
@@ -655,9 +662,9 @@ RestWrite.prototype._validateUserName = function() {
655
662
} ;
656
663
657
664
/*
658
- As with username's, parse should not allow case insensitive collisions of email
659
- unlike with usernames (which can have case insensitive collisions) emails should
660
- never have a case insensitive collision.
665
+ As with usernames, Parse should not allow case insensitive collisions of email.
666
+ unlike with usernames (which can have case insensitive collisions in the case of
667
+ auth adapters), emails should never have a case insensitive collision.
661
668
662
669
This behavior can be enforced through a properly configured index see:
663
670
https://docs.mongodb.com/manual/core/index-case-insensitive/#create-a-case-insensitive-index
@@ -685,7 +692,8 @@ RestWrite.prototype._validateEmail = function() {
685
692
this . className ,
686
693
{
687
694
email : { $regex : `^${ this . data . email } $` , $options : 'i' } ,
688
- objectId : { $ne : this . objectId ( ) } } ,
695
+ objectId : { $ne : this . objectId ( ) } ,
696
+ } ,
689
697
{ limit : 1 } ,
690
698
{ } ,
691
699
this . validSchemaController
0 commit comments