Luke Granger-Brown
ee3299223a
...except things under /accounts/, because I generally just trust that to do access control for me.
15 lines
452 B
Python
15 lines
452 B
Python
from django.contrib.auth.decorators import login_required
|
|
|
|
|
|
class LoginRequiredMiddleware:
|
|
def __init__(self, get_response):
|
|
self.get_response = get_response
|
|
|
|
def is_open_url(self, path_info):
|
|
return path_info.startswith('/accounts/')
|
|
|
|
def __call__(self, request):
|
|
if not self.is_open_url(request.path_info):
|
|
return login_required()(self.get_response)(request)
|
|
|
|
return self.get_response(request)
|