8000
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 4d1e0a4 commit 2013321Copy full SHA for 2013321
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
10
from cms.toolbar.toolbar import CMSToolbar
@@ -26,8 +28,13 @@ def is_cms_request(self, request):
26
28
27
29
if internal_ips:
30
client_ip = get_request_ip(request)
- if client_ip not in internal_ips:
31
+ try:
32
+ client_ip = forms.GenericIPAddressField().clean(client_ip)
33
+ except ValidationError:
34
return False
35
+ else:
36
+ if client_ip not in internal_ips:
37
+ return False
38
39
if not toolbar_hide:
40
return True
0 commit comments