mirror of
https://github.com/pinry/pinry.git
synced 2025-11-13 16:45:41 +01:00
Refactor apps to be in repo folder
This commit is contained in:
15
users/middleware.py
Normal file
15
users/middleware.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
|
||||
class Public(object):
|
||||
def process_request(self, request):
|
||||
if settings.PUBLIC == False and not request.user.is_authenticated():
|
||||
acceptable_paths = [
|
||||
'/login/',
|
||||
'/private/',
|
||||
'/register/',
|
||||
]
|
||||
if request.path not in acceptable_paths:
|
||||
return HttpResponseRedirect(reverse('users:private'))
|
||||
Reference in New Issue
Block a user