Require logins to be all-lowercase. This was prompted by repeated

trouble with people registering non-lowercase logins, then trying to
log in with all-lowercase, or vice versa.
 - Legacy-Id: 6472
This commit is contained in:
Henrik Levkowetz 2013-10-21 20:26:03 +00:00
parent d649fd5e10
commit a7db9eec43

View file

@ -15,7 +15,7 @@ from ietf.person.models import Person, Email
class RegistrationForm(forms.Form):
email = forms.EmailField(label="Your email")
email = forms.EmailField(label="Your email (lowercase)")
realm = 'IETF'
expire = 3
@ -45,6 +45,8 @@ class RegistrationForm(forms.Form):
email = self.cleaned_data.get('email', '')
if not email:
return email
if email.lower() != email:
raise forms.ValidationError(_('The supplied address contained uppercase letters. Please use a lowercase email address.'))
if User.objects.filter(username=email).count():
raise forms.ValidationError(_('An account with the email address you provided already exists.'))
return email