From c5d4d5435c22e4dcf2f2cc289658bed08bd4f096 Mon Sep 17 00:00:00 2001 From: Raymond Penners Date: Fri, 31 May 2024 09:35:17 +0200 Subject: [PATCH] refactor(account/forms): Move email2 lower to clean() --- allauth/account/forms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/allauth/account/forms.py b/allauth/account/forms.py index 0c4f4fab01..e391a88cb9 100644 --- a/allauth/account/forms.py +++ b/allauth/account/forms.py @@ -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) @@ -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