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

  1. Serialize a model instance by chriswedgwood 1 week, 2 days ago
  2. Automatically setup raw_id_fields ForeignKey & OneToOneField by agusmakmun 9 months, 1 week ago
  3. Crispy Form by sourabhsinha396 10 months ago
  4. ReadOnlySelect by mkoistinen 10 months, 2 weeks ago
  5. Verify events sent to your webhook endpoints by santos22 11 months, 2 weeks ago

Comments

Please login first before commenting.