mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-12-24 17:42:23 +00:00
Nettoie la conf settings
This commit is contained in:
parent
1b2023fca8
commit
75424a6108
@ -150,4 +150,3 @@ PAGINATION_NUMBER = 25
|
||||
|
||||
PAGINATION_LARGE_NUMBER = 8
|
||||
|
||||
GENERIC_IPSET_COMMAND = "/sbin/ipset -q "
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import redirect
|
||||
from med.settings import AUTHORIZED_IP_RANGE, AUTHORIZED_IP6_RANGE
|
||||
import ipaddress
|
||||
|
||||
@ -34,7 +35,7 @@ def user_is_in_campus(function):
|
||||
if not request.user.is_authenticated:
|
||||
remote_ip = get_ip(request)
|
||||
if not ipaddress.ip_address(remote_ip) in ipaddress.ip_network(AUTHORIZED_IP_RANGE) and not ipaddress.ip_address(remote_ip) in ipaddress.ip_network(AUTHORIZED_IP6_RANGE):
|
||||
raise PermissionDenied
|
||||
return redirect("/")
|
||||
return function(request, *args, **kwargs)
|
||||
wrap.__doc__ = function.__doc__
|
||||
wrap.__name__ = function.__name__
|
||||
|
Loading…
Reference in New Issue
Block a user