diff --git a/shelfzilla/apps/account/forms.py b/shelfzilla/apps/account/forms.py index 880ddb9..559f509 100644 --- a/shelfzilla/apps/account/forms.py +++ b/shelfzilla/apps/account/forms.py @@ -56,26 +56,11 @@ class RegistrationForm(forms.ModelForm): widget=forms.PasswordInput) password2 = forms.CharField(label=_('Repeat password'), widget=forms.PasswordInput) - access_code = forms.CharField(label=_('Invitation code'), required=True) class Meta: model = models.User fields = ('email', 'username', ) - def get_access_code(self): - try: - return models.AccessCode.objects.get( - code=self.cleaned_data['access_code']) - except models.AccessCode.DoesNotExist: - return False - - def clean_access_code(self): - code = self.get_access_code() - if not code or (code and not code.usable): - raise forms.ValidationError(_('Invitation code is not valid')) - - return self.cleaned_data['access_code'] - def clean_password2(self): # Check that the two password entries match password1 = self.cleaned_data.get("password1") @@ -88,9 +73,7 @@ class RegistrationForm(forms.ModelForm): # Save the provided password in hashed format with transaction.atomic(): user = super(RegistrationForm, self).save(commit=False) - access_code = self.get_access_code() - user.access_code = access_code user.set_password(self.cleaned_data["password1"]) if commit: user.save() - return user + return user \ No newline at end of file