Commits

Marko Mrdjenovic committed 93d91a2

don't check invitation key if not supplied

Comments (0)

Files changed (1)

registration/forms.py

         
         """
         key = self.cleaned_data['invitation_key']
-        try:
-            inv = RegistrationInvitation.objects.get(invitation_key=key)
-            if inv.invitation_key_expired():
-                raise forms.ValidationError(_("The supplied invitation key has expired."))
-        except RegistrationInvitation.DoesNotExist:
-            raise forms.ValidationError(_("The supplied invitation key is invalid."))
+        if key:
+            try:
+                inv = RegistrationInvitation.objects.get(invitation_key=key)
+                if inv.invitation_key_expired():
+                    raise forms.ValidationError(_("The supplied invitation key has expired."))
+            except RegistrationInvitation.DoesNotExist:
+                raise forms.ValidationError(_("The supplied invitation key is invalid."))
         return key