mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-08-21 18:07:20 +02:00
There was an error when an email was already used
This commit is contained in:
@@ -22,6 +22,15 @@ class SignupForm(UserCreationForm):
|
||||
],
|
||||
)
|
||||
|
||||
def clean_email(self):
|
||||
"""
|
||||
Ensure that the email address is unique.
|
||||
"""
|
||||
email = self.data["email"]
|
||||
if User.objects.filter(email=email).exists():
|
||||
self.add_error("email", _("This email address is already used."))
|
||||
return email
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["first_name"].required = True
|
||||
|
Reference in New Issue
Block a user