removed RequireLoginMiddleware
This commit is contained in:
parent
79f00ef686
commit
69404ac120
@ -33,29 +33,10 @@
|
||||
import re
|
||||
import threading
|
||||
|
||||
class RequireLoginMiddleware(object):
|
||||
"""
|
||||
Require Login middleware. If enabled, each Django-powered page will
|
||||
require authentication.
|
||||
|
||||
If an anonymous user requests a page, he/she is redirected to the login
|
||||
page set by LOGIN_URL.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.exceptionre = re.compile("(^/media/)|(^/robots.txt)|(^/login/)")
|
||||
|
||||
def process_request(self, request):
|
||||
if request.user.is_anonymous() and not self.exceptionre.search(request.path):
|
||||
if request.POST:
|
||||
return login(request)
|
||||
else:
|
||||
return HttpResponseRedirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
|
||||
|
||||
|
||||
user_holder = threading.local()
|
||||
user_holder.user = None
|
||||
|
||||
# END REQUIRE LOGIN MIDDLEWARE
|
||||
|
||||
class AutoUserMiddleware(object):
|
||||
'''Saves the current user so it can be retrieved by the admin'''
|
||||
|
@ -49,7 +49,6 @@
|
||||
'django.middleware.http.ConditionalGetMiddleware',
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.doc.XViewMiddleware",
|
||||
"archweb.main.middleware.RequireLoginMiddleware",
|
||||
"archweb.main.middleware.AutoUserMiddleware",
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user