##// END OF EJS Templates
Whitelist of IPs that will not be banned (starting from localhost)
neko259 -
r1993:564f7dbe default
parent child Browse files
Show More
@@ -19,6 +19,7 b' Autoban = false'
19 DefaultTag = test
19 DefaultTag = test
20 MaxFileCount = 5
20 MaxFileCount = 5
21 AdditionalSpoilerSpaces = false
21 AdditionalSpoilerSpaces = false
22 BanWhitelist = 127.0.0.1
22
23
23 [Messages]
24 [Messages]
24 # Thread bumplimit
25 # Thread bumplimit
@@ -27,3 +27,7 b' def get_list_dict(section, name):'
27 return [item.split(':') for item in str_dict.split(',')]
27 return [item.split(':') for item in str_dict.split(',')]
28
28
29
29
30 def get_list(section, name):
31 str_list = get(section, name)
32 return str_list.split(',')
33
@@ -1,7 +1,7 b''
1 from django.db import transaction
1 from django.db import transaction
2 from django.views.generic import View
2 from django.views.generic import View
3
3
4 from boards import utils
4 from boards import utils, settings
5 from boards.models.user import Ban
5 from boards.models.user import Ban
6
6
7
7
@@ -22,9 +22,11 b' class BaseBoardView(View):'
22 """
22 """
23
23
24 ip = utils.get_client_ip(request)
24 ip = utils.get_client_ip(request)
25 ban, created = Ban.objects.get_or_create(ip=ip)
25 whitelist = settings.get_list('Forms', 'BanWhitelist')
26 if created:
26 if not ip in whitelist:
27 ban.can_read = False
27 ban, created = Ban.objects.get_or_create(ip=ip)
28 ban.reason = BAN_REASON_SPAM
28 if created:
29 ban.save()
29 ban.can_read = False
30 ban.reason = BAN_REASON_SPAM
31 ban.save()
30
32
General Comments 0
You need to be logged in to leave comments. Login now