Skip to content

Commit

Permalink
refactor(account/forms): Move email2 lower to clean()
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed May 31, 2024
1 parent 11a5964 commit c5d4d54
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion allauth/account/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ def clean_email(self):
value = self.validate_unique_email(value)
return value

def clean_email2(self):
value = self.cleaned_data["email2"].lower()
return value

def validate_unique_email(self, value):
adapter = get_adapter()
assessment = assess_unique_email(value)
Expand All @@ -361,7 +365,7 @@ def clean(self):
if app_settings.SIGNUP_EMAIL_ENTER_TWICE:
email = cleaned_data.get("email")
email2 = cleaned_data.get("email2")
if (email and email2) and email != email2.lower():
if (email and email2) and email != email2:
self.add_error("email2", _("You must type the same email each time."))
return cleaned_data

Expand Down

0 comments on commit c5d4d54

Please sign in to comment.