Skip to content

Commit

Permalink
Merge 6db5031 into 9c83373
Browse files Browse the repository at this point in the history
  • Loading branch information
imposeren committed Jul 17, 2015
2 parents 9c83373 + 6db5031 commit df35111
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sitegate/signup_flows/classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from ..settings import SIGNUP_VERIFY_EMAIL_BODY, SIGNUP_VERIFY_EMAIL_TITLE, SIGNUP_VERIFY_EMAIL_NOTICE, SIGNUP_VERIFY_EMAIL_VIEW_NAME


USERNAME_FIELD = getattr(USER, 'USERNAME_FIELD', 'username')


class ClassicSignupForm(UserCreationForm):
"""Classic form tuned to support custom user model."""

Expand All @@ -22,7 +25,7 @@ class ClassicSignupForm(UserCreationForm):

class Meta:
model = USER
fields = ('username',)
fields = (USERNAME_FIELD,)

def clean_username(self):
username = self.cleaned_data['username']
Expand Down Expand Up @@ -70,7 +73,10 @@ class ClassicWithEmailSignupForm(ClassicSignupForm):

class Meta:
model = USER
fields = ('username', 'email', 'password1', 'password2')
if USERNAME_FIELD != 'email':
fields = (USERNAME_FIELD, 'email', 'password1', 'password2')
else:
fields = (USERNAME_FIELD, 'password1', 'password2')

def __init__(self, *args, **kwargs):
super(ClassicWithEmailSignupForm, self).__init__(*args, **kwargs)
Expand Down

0 comments on commit df35111

Please sign in to comment.