From 75424a6108f0586fb9da4e963f70ca95387c2307 Mon Sep 17 00:00:00 2001 From: Med Date: Fri, 28 Jul 2017 05:35:45 +0200 Subject: [PATCH] Nettoie la conf settings --- med/settings.py | 1 - users/decorators.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/med/settings.py b/med/settings.py index 5aa1037..6ff01b0 100644 --- a/med/settings.py +++ b/med/settings.py @@ -150,4 +150,3 @@ PAGINATION_NUMBER = 25 PAGINATION_LARGE_NUMBER = 8 -GENERIC_IPSET_COMMAND = "/sbin/ipset -q " diff --git a/users/decorators.py b/users/decorators.py index 1cc6837..c71a6e8 100644 --- a/users/decorators.py +++ b/users/decorators.py @@ -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__