Prevent space from being in username during registration

This commit is contained in:
Raynaldo Rivera 2014-10-13 11:12:27 -07:00
parent 9f0047b3a7
commit dbcade4146

View File

@ -9,6 +9,9 @@ class RegistrationForm(forms.Form):
email_again = forms.CharField(max_length=254, required=True, label="Email Again")
def clean(self):
if ' ' in self.cleaned_data['username']:
raise forms.ValidationError(u'Username can not contain a space')
if 'password' in self.cleaned_data and 'password_again' in self.cleaned_data:
if self.cleaned_data['password'] != self.cleaned_data['password_again']:
raise forms.ValidationError(u'Passwords do not match')