I’ve got a django app whose views currently use the @login_required decorator.
What’s the easiest/best way to add extra logic to the login system? I want to add extra constraints such as that their subscription to the site is still valid. If it has expired I want to direct them to a page that says their subscription has expired and that they’ll need to pay again.
Ideally a signal would be great, but I can’t find any kind of post_login signal. Failing that I suppose my options are to write my own login handler, or to have some kind of check_valid_user() method that I call inside each of my views. I don’t favour the latter since another dev could forget to add it, and users could get content for free.
What approach would people recommend?
Thanks
You can write own login view or better own authbackend(second example).