Great solution Sam!
On Tuesday, April 9, 2013 11:30:41 AM UTC-7, Sam Solomon wrote:
>
> Depending on if the expiration is a temporary thing or if you actually
> want to permanently deactivate the user, this may be even simpler and
> database efficient (and is what we use to ban users):
>
> class
Depending on if the expiration is a temporary thing or if you actually want
to permanently deactivate the user, this may be even simpler and database
efficient (and is what we use to ban users):
class DeactivateUserMiddleware(object):
def process_request(self, request):
if request.us
On Apr 5, 2013, at 5:33 PM, Nikolas Stevenson-Molnar
wrote:
> How about creating request middleware to sign out deactivated users?
> Something like:
>
> if request.user.profile.expired:
>logout(request)
>
> If you're concerned about the extra database hit per request, then maybe
> cache th
On Sat, Apr 6, 2013 at 12:24 AM, John DeRosa
wrote:
> I have a Profile table that's 1:1 with the User table. Each Profile row has
> an account_expiration field.
>
> I want to invalidate users when their accounts expire. By "invalidate", I
> mean: They can't log in, and they can't use the system an
How about creating request middleware to sign out deactivated users?
Something like:
if request.user.profile.expired:
logout(request)
If you're concerned about the extra database hit per request, then maybe
cache the expiration?
expire_date = cache.get("%d_expire" % request.user.id)
if not e
I have a Profile table that's 1:1 with the User table. Each Profile row has
an account_expiration field.
I want to invalidate users when their accounts expire. By "invalidate", I
mean: They can't log in, and they can't use the system any more.
The closer I look, the more complicated it seems.
6 matches
Mail list logo