10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92561a7 commit dac7fa7Copy full SHA for dac7fa7
cms/middleware/toolbar.py
@@ -2,7 +2,9 @@
2
"""
3
Edit Toolbar middleware
4
5
+from django import forms
6
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE
7
+from django.core.exceptions import ValidationError
8
from django.core.urlresolvers import resolve
9
from django.http import HttpResponse
10
@@ -27,8 +29,13 @@ def is_cms_request(self, request):
27
29
28
30
if internal_ips:
31
client_ip = get_request_ip(request)
- if client_ip not in internal_ips:
32
+ try:
33
+ client_ip = forms.GenericIPAddressField().clean(client_ip)
34
+ except ValidationError:
35
return False
36
+ else:
37
+ if client_ip not in internal_ips:
38
+ return False
39
40
if not toolbar_hide:
41
return True
0 commit comments