Ensure lowercase on emails on conference registrations
authorMagnus Hagander <magnus@hagander.net>
Tue, 11 Sep 2018 14:38:23 +0000 (16:38 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 11 Sep 2018 14:38:23 +0000 (16:38 +0200)
Previously the duplication check would work case sensitive, so the same
email could be used twice with different spellings. This caused
duplicate registrations due to lack of verification by the people who
registered.

postgresqleu/confreg/forms.py

index 3da0479ce4ef968323910457e4d4ab82ce17d17f..40819ec2d281b624bbbc278c2bd8e411d4261540 100644 (file)
@@ -72,7 +72,7 @@ class ConferenceRegistrationForm(forms.ModelForm):
                return newval
 
        def clean_email(self):
-               e = self.cleaned_data.get('email')
+               e = self.cleaned_data.get('email').lower()
                try:
                        r = ConferenceRegistration.objects.get(email=e, conference=self.instance.conference)
                        if r.id != self.instance.id:
@@ -330,7 +330,7 @@ class NewMultiRegForm(forms.Form):
                super(NewMultiRegForm, self).__init__(*args, **kwargs)
 
        def clean_email(self):
-               e = self.cleaned_data.get('email')
+               e = self.cleaned_data.get('email').lower()
 
                if ConferenceRegistration.objects.filter(conference=self.conference, email=e).exists():
                        raise ValidationError("A registration for this email address already exists. For privacy reasons, management of a registration cannot be transferred.")