summaryrefslogtreecommitdiff
path: root/main/sitelogin.py
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2008-03-08 00:13:41 -0800
committereliott <eliott@cactuswax.net>2008-03-08 00:13:41 -0800
commit9b7b5122544283fc32d81d785e94c5f4aacc0109 (patch)
treeba117f7fadc24737920fa4f1b9a711157e629cc5 /main/sitelogin.py
parent7e2d0f2f0cd8f176cf82c02d704ad4fe25a07b3b (diff)
Moved models around
Diffstat (limited to 'main/sitelogin.py')
-rw-r--r--main/sitelogin.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/sitelogin.py b/main/sitelogin.py
new file mode 100644
index 00000000..53721095
--- /dev/null
+++ b/main/sitelogin.py
@@ -0,0 +1,15 @@
+from django.contrib.auth.views import logout_then_login, login
+from django.conf import settings
+
+class SiteLogin:
+ def __init__(self):
+ self.login_path = settings.LOGIN_URL
+ def process_request(self, request):
+ if request.user.is_anonymous() and request.path != self.login_path:
+ if request.POST:
+ return login(request)
+ else:
+ return HttpResponseRedirect('%s?next=%s' % (self.login_path, request.path))
+
+# vim: set ts=4 sw=4 et:
+