Commit 601045d3 by Linus Lewandowski

Allow specifying user's name during registration.

parent e010d2c8
Pipeline #11471191 passed with stages
in 6 minutes 8 seconds
......@@ -18,10 +18,18 @@ class AuthRegisterForm(forms.Form):
help_text=password_validation.password_validators_help_text_html(),
)
given_name = forms.CharField(label=_("Given name"), required=False)
family_name = forms.CharField(label=_("Family name"), required=False)
def process(self, request):
email = self.cleaned_data['email']
password = self.cleaned_data['password']
profile_data = dict(
given_name = self.cleaned_data['given_name'],
family_name = self.cleaned_data['family_name'],
)
site = get_current_site(request)
try:
......@@ -30,6 +38,8 @@ class AuthRegisterForm(forms.Form):
username, domain = email.split('@', 1)
user = create_user(username)
user.set_password(password)
for k, v in profile_data.items():
setattr(user, k, v)
user.save()
send_mail(email, 'registration/email/welcome', {
......
Markdown is supported
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