1. Nico den Boer
  2. django-registration

Commits

ubernostrum  committed 2b06dfb

Fixed #45: Only do the password-matching check if the password fields otherwise pass validation.

  • Participants
  • Parent commits 383ca39
  • Branches default

Comments (0)

Files changed (1)

File registration/forms.py

View file
  • Ignore whitespace
         Validates that the two password inputs match.
         
         """
-        if self.cleaned_data['password1'] == self.cleaned_data['password2']:
-            return self.cleaned_data['password2']
-        raise forms.ValidationError(_(u'You must type the same password each time'))
+        if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
+            if self.cleaned_data['password1'] == self.cleaned_data['password2']:
+                return self.cleaned_data['password2']
+            raise forms.ValidationError(_(u'You must type the same password each time'))
     
     def save(self, profile_callback=None):
         """