comparison gpp/core/middleware.py @ 215:8c1832b9d815

Implement #84; additional checks on spammers; implement stranger status.
author Brian Neal <bgneal@gmail.com>
date Sat, 29 May 2010 04:51:28 +0000
parents
children 423c39ee44e0
comparison
equal deleted inserted replaced
214:28988cce138b 215:8c1832b9d815
1 """Common middleware for the entire project."""
2 from django.contrib.auth import logout
3
4 class InactiveUserMiddleware(object):
5 """
6 This middleware ensures users with is_active set to False get their
7 session destroyed and are treated as logged out.
8 This middleware should come after the 'django.contrib.auth.middleware.
9 AuthenticationMiddleware' in settings.py.
10 Idea taken from: http://djangosnippets.org/snippets/1105/
11 """
12
13 def process_request(self, request):
14 if request.user.is_authenticated() and not request.user.is_active:
15 logout(request)
16