Middleware question:

If 100% of an apps views require a logged-in user except for the login
page, does it makes sense to have middleware check the URL and
redirect to the login page rather than putting the @login_required
decorator over all the views?

I have to ensure that users' passwords expire, and to do that I need
to check the user's profile on each page load and redirect to the
password change page if it has.
I tried doing this within a context processor, but redirection doesn't
work from there. I was told on the IRC channel that I should be using
middleware.

If that's the case, doesn't it makes sense to just handle the (nearly
identical) task of @login_required in the same middleware?

Thanks,
Shawn

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to