Commit 1d793461 authored by Noe Nieto's avatar Noe Nieto 💬
Browse files

convert userid and recovery email to lowercase to avoid problems like Purism/LibremOne/task#357

parent f76fe7b7
...@@ -69,6 +69,9 @@ class CartRegistrationForm(RegistrationForm): ...@@ -69,6 +69,9 @@ class CartRegistrationForm(RegistrationForm):
super(CartRegistrationForm, self).__init__(*args, **kwargs) super(CartRegistrationForm, self).__init__(*args, **kwargs)
self.fields['username'].validators.append(validate_reserved_names) self.fields['username'].validators.append(validate_reserved_names)
def clean_email(self):
return self.cleaned_data['email'].lower()
class CartRegistrationFormWithCaptcha(CartRegistrationForm): class CartRegistrationFormWithCaptcha(CartRegistrationForm):
captcha = CaptchaField( captcha = CaptchaField(
......
...@@ -88,6 +88,10 @@ class User(AbstractUser): ...@@ -88,6 +88,10 @@ class User(AbstractUser):
default=AccountType.UNDEFINED) default=AccountType.UNDEFINED)
billing_email = models.EmailField(default='', null=False) billing_email = models.EmailField(default='', null=False)
def clean(self):
super().clean()
self.email = self.email.lower()
@classmethod @classmethod
def normalize_username(cls, username): def normalize_username(cls, username):
username = super(User, cls).normalize_username(username) username = super(User, cls).normalize_username(username)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment