diff -r 057498d12450 -r af9ab5ad2786 reg/forms.py --- a/reg/forms.py Fri Apr 09 15:35:40 2010 +0530 +++ b/reg/forms.py Fri Apr 09 15:48:47 2010 +0530 @@ -1,8 +1,7 @@ import string +from django import forms from django.contrib.auth.models import User -from django import forms - from django.contrib.auth import authenticate from workshop.reg.models import Profile @@ -47,6 +46,9 @@ fields = ['email', 'password', 'confirm_password', 'first_name', 'last_name', 'gender', 'profession', 'affiliated_to', 'interests'] def clean_email(self): + """ check if a user exists with same email. + """ + email = self.cleaned_data['email'] try: User.objects.get(email__iexact=email) @@ -56,6 +58,11 @@ return email def clean_password(self): + """ check if the password contains only alphabets or digits or punctuation. + then check if the size of the password is optimal. + then check if both the given passwords match. + """ + password = self.cleaned_data['password'] if password.strip(string.ascii_letters+string.punctuation+string.digits):