views:

36

answers:

1

If I have a site that uses cookies for authorisation, so when the user returns they don't have to login again. If for some reason the site admin cancel this users account what is the best way to check for this. I don't want to have to hit the database every time the user visits a page to make sure their account is still live. So how should I handle this situation?

A: 

Several options. Set a shorter expiration on the cookie so they'd have to get authenticated afresh sooner.

Another alternative is to have any important action require that they be authenticated against the database. Thus you would only be hitting the database for more privileged actions that would more likely overlap with the high priority things you'd want a cancelled user be unable to do.

dove