1 from django.contrib.auth.middleware import AuthenticationMiddleware
\r
2 from django.contrib.auth import logout
\r
3 from forum.models.user import AnonymousUser
\r
4 from forum.views.auth import forward_suspended_user
\r
6 class ExtendedUser(AuthenticationMiddleware):
\r
7 def process_request(self, request):
\r
8 super(ExtendedUser, self).process_request(request)
\r
9 if request.user.is_authenticated():
\r
11 request.user = request.user.user
\r
13 if request.user.is_suspended():
\r
16 return forward_suspended_user(request, user)
\r
22 request.user = AnonymousUser()
\r