Add display name (first_name) shown instead of username on user-facing UI
All checks were successful
Docker / build (release) Successful in 9s

This commit is contained in:
krek0 2026-05-17 07:08:29 +02:00
parent 28f279a4ab
commit 4e23d45472
4 changed files with 20 additions and 3 deletions

View file

@ -8,6 +8,12 @@ from django.utils.translation import gettext_lazy as _
class CustomSignupForm(SignupForm):
first_name = forms.CharField(
label=_("Display name"),
max_length=150,
required=True,
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -16,6 +22,12 @@ class CustomSignupForm(SignupForm):
"Please enter a valid email address ending with `@ens-rennes.fr`"
)
def save(self, request):
user = super().save(request)
user.first_name = self.cleaned_data["first_name"]
user.save()
return user
def clean_email(self):
"""
Check that the email address ends with a trusted domain.