Login

Set test cookie unless logged in

Author:
nipuL
Posted:
April 4, 2008
Language:
Python
Version:
.96
Tags:
middleware cookie login
Score:
1 (after 1 ratings)

This allows you to use a quick login forms outside of the django.contrib.auth.views.login view, the cookie will be deleted once you login.

1
2
3
4
class SetTestCookieMiddleware(object):
	def process_request(self, request):
		if not request.user.is_authenticated():
			request.session.set_test_cookie()

More like this

Comments

Please login first before commenting.