Revision f289f4c8
b/flowspec/forms.py | ||
---|---|---|
42 | 42 |
send_mail(settings.EMAIL_SUBJECT_PREFIX + "Caught an attempt to set a protected IP/network as a source address", |
43 | 43 |
mail_body, settings.SERVER_EMAIL, |
44 | 44 |
settings.NOTIFY_ADMIN_MAILS, fail_silently=True) |
45 |
raise forms.ValidationError("Not allowed")
|
|
45 |
raise Exception
|
|
46 | 46 |
if address.is_private: |
47 | 47 |
private_error = True |
48 |
raise forms.ValidationError('Private addresses not allowed')
|
|
48 |
raise Exception
|
|
49 | 49 |
else: |
50 | 50 |
return self.cleaned_data["source"] |
51 | 51 |
except Exception: |
... | ... | |
58 | 58 |
|
59 | 59 |
def clean_destination(self): |
60 | 60 |
user = User.objects.get(pk=self.data['applier']) |
61 |
peer = user.get_profile().peer
|
|
61 |
peer = user.get_profile().peer |
|
62 | 62 |
data = self.cleaned_data['destination'] |
63 | 63 |
error = None |
64 | 64 |
protected_error = False |
... | ... | |
72 | 72 |
send_mail(settings.EMAIL_SUBJECT_PREFIX + "Caught an attempt to set a protected IP/network as the destination address", |
73 | 73 |
mail_body, settings.SERVER_EMAIL, |
74 | 74 |
settings.NOTIFY_ADMIN_MAILS, fail_silently=True) |
75 |
raise forms.ValidationError("Not allowed")
|
|
75 |
raise Exception
|
|
76 | 76 |
if address.prefixlen < settings.PREFIX_LENGTH: |
77 | 77 |
error = "Currently no prefix lengths < %s are allowed" %settings.PREFIX_LENGTH |
78 |
raise forms.ValidationError('error')
|
|
78 |
raise Exception
|
|
79 | 79 |
return self.cleaned_data["destination"] |
80 | 80 |
except Exception: |
81 | 81 |
error_text = 'Invalid network address format' |
... | ... | |
95 | 95 |
raise forms.ValidationError('Invalid date range') |
96 | 96 |
|
97 | 97 |
def clean(self): |
98 |
if self.errors: |
|
99 |
raise forms.ValidationError('Errors in form. Please review and fix them') |
|
98 | 100 |
name = self.cleaned_data.get('name', None) |
99 | 101 |
source = self.cleaned_data.get('source', None) |
100 | 102 |
sourceports = self.cleaned_data.get('sourceport', None) |
Also available in: Unified diff