Login message middleware
Uses the Message model in django.contrib.auth.models to display a welcoming login message.
- middleware
- login
- logout
Uses the Message model in django.contrib.auth.models to display a welcoming login message.
This was born as a result of the fact that session data is shared across logins on a single browser. If you login as user1 and session data is stored, then login as user2 the same session data will be available to your application. Please see the ticket who's validity is at this point in question. Some feel that this is normal behavior. http://code.djangoproject.com/ticket/6941 I use this code in conjunction with http://code.google.com/p/django-registration/ Place this code in registration.__init__ and change registration.urls to have login and logout route to the new alternate versions alt_login, alt_logout. I have only been using Python and Django for a couple months now so I hope that this implementation is not too terrible. It works for me. Enjoy.
This Middleware is to log users out after a certain amount of time has passed. You'll want to add AUTO_LOGOUT_DELAY to your settings.py, set to a number of minutes after which a user should be logged out. It adds the key 'last_touch' to the session, you'll want to change that if you happen to be using that already.
3 snippets posted so far.