Refactor apps to be in repo folder

This commit is contained in:
Isaac Bythewood
2018-02-08 21:57:49 -05:00
parent 9d00c74d18
commit 1fcdf2a9a3
33 changed files with 15 additions and 15 deletions

15
users/middleware.py Normal file
View 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'))