From b3e9fe27f2b0de7adeacab1c9db847e7123c1dd0 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Thu, 23 Jan 2014 23:34:21 -0500 Subject: [PATCH] Allow users to decide their username on account creation #303 --- karmaworld/apps/users/forms.py | 2 ++ karmaworld/settings/common.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/karmaworld/apps/users/forms.py b/karmaworld/apps/users/forms.py index ee12d51..ac7e9a7 100644 --- a/karmaworld/apps/users/forms.py +++ b/karmaworld/apps/users/forms.py @@ -5,11 +5,13 @@ from django import forms class SignupForm(forms.Form): + username = forms.CharField(max_length=255, required=True, label='Username') first_name = forms.CharField(max_length=255, required=False, label='Given name') last_name = forms.CharField(max_length=255, required=False, label='Family name') email = forms.EmailField(label='Email address') def save(self, user): + user.username = self.cleaned_data['username'] user.first_name = self.cleaned_data['first_name'] user.last_name = self.cleaned_data['last_name'] user.email = self.cleaned_data['email'] diff --git a/karmaworld/settings/common.py b/karmaworld/settings/common.py index f8853e9..ba16684 100644 --- a/karmaworld/settings/common.py +++ b/karmaworld/settings/common.py @@ -266,7 +266,7 @@ ACCOUNT_AUTHENTICATION_METHOD = "email" ACCOUNT_CONFIRM_EMAIL_ON_GET = False ACCOUNT_EMAIL_VERIFICATION = "optional" ACCOUNT_EMAIL_SUBJECT_PREFIX = "KarmaNotes.org -- " -ACCOUNT_USERNAME_REQUIRED = False +ACCOUNT_USERNAME_REQUIRED = True SOCIALACCOUNT_EMAIL_REQUIRED = True SOCIALACCOUNT_EMAIL_VERIFICATION = "optional" SOCIALACCOUNT_QUERY_EMAIL = True -- 2.25.1