2012-07-12 05:32:07 +00:00
|
|
|
from django import forms
|
|
|
|
|
|
|
|
import account.forms
|
|
|
|
|
|
|
|
|
|
|
|
class SignupForm(account.forms.SignupForm):
|
2014-07-30 18:19:26 +00:00
|
|
|
|
2012-07-12 05:32:07 +00:00
|
|
|
first_name = forms.CharField()
|
|
|
|
last_name = forms.CharField()
|
|
|
|
email_confirm = forms.EmailField(label="Confirm Email")
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(SignupForm, self).__init__(*args, **kwargs)
|
|
|
|
del self.fields["username"]
|
|
|
|
self.fields.keyOrder = [
|
|
|
|
"email",
|
|
|
|
"email_confirm",
|
|
|
|
"first_name",
|
|
|
|
"last_name",
|
|
|
|
"password",
|
|
|
|
"password_confirm"
|
|
|
|
]
|
2014-07-30 18:19:26 +00:00
|
|
|
|
2012-07-12 05:32:07 +00:00
|
|
|
def clean_email_confirm(self):
|
|
|
|
email = self.cleaned_data.get("email")
|
|
|
|
email_confirm = self.cleaned_data["email_confirm"]
|
|
|
|
if email:
|
|
|
|
if email != email_confirm:
|
2014-07-30 18:19:26 +00:00
|
|
|
raise forms.ValidationError(
|
|
|
|
"Email address must match previously typed email address")
|
2012-07-12 05:32:07 +00:00
|
|
|
return email_confirm
|