mirror of
				https://gitlab.crans.org/mediatek/med.git
				synced 2025-11-04 05:02:19 +01:00 
			
		
		
		
	Nettoie la conf settings
This commit is contained in:
		@@ -150,4 +150,3 @@ PAGINATION_NUMBER = 25
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
PAGINATION_LARGE_NUMBER = 8
 | 
					PAGINATION_LARGE_NUMBER = 8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GENERIC_IPSET_COMMAND = "/sbin/ipset -q "
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from django.core.exceptions import PermissionDenied
 | 
					from django.core.exceptions import PermissionDenied
 | 
				
			||||||
 | 
					from django.shortcuts import redirect
 | 
				
			||||||
from med.settings import AUTHORIZED_IP_RANGE, AUTHORIZED_IP6_RANGE
 | 
					from med.settings import AUTHORIZED_IP_RANGE, AUTHORIZED_IP6_RANGE
 | 
				
			||||||
import ipaddress
 | 
					import ipaddress
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -34,7 +35,7 @@ def user_is_in_campus(function):
 | 
				
			|||||||
        if not request.user.is_authenticated:
 | 
					        if not request.user.is_authenticated:
 | 
				
			||||||
            remote_ip = get_ip(request)
 | 
					            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):
 | 
					            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)
 | 
					        return function(request, *args, **kwargs)
 | 
				
			||||||
    wrap.__doc__ = function.__doc__
 | 
					    wrap.__doc__ = function.__doc__
 | 
				
			||||||
    wrap.__name__ = function.__name__
 | 
					    wrap.__name__ = function.__name__
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user