🐛(backend) filter invitation with case insensitive email

A user can be invited and no control is made on the email case. Then,
when a new user is created, we are looking if there are pending
invitation and the lookup used is case sensitive. We change it using
__iexact which is case insensitive.
This commit is contained in:
Manuel Raynaud
2025-10-07 11:41:45 +02:00
parent b3980e7bf1
commit 590b67fd71
3 changed files with 33 additions and 2 deletions

View File

@@ -221,7 +221,7 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin):
Expired invitations are ignored.
"""
valid_invitations = Invitation.objects.filter(
email=self.email,
email__iexact=self.email,
created_at__gte=(
timezone.now()
- timedelta(seconds=settings.INVITATION_VALIDITY_DURATION)