Prevent session expiry as long as the user has reloaded in the past two weeks

Fixes (?) #416.

(imported from commit 9d56fe4125f742e2cdccc41ebd385daacccf461f)
This commit is contained in:
Keegan McAllister 2012-11-20 18:42:16 -05:00
parent ced6921491
commit 161af7838f

View File

@ -146,6 +146,11 @@ def accounts_home(request):
@login_required(login_url = settings.HOME_NOT_LOGGED_IN)
def home(request):
# We need to modify the session object every two weeks or it will expire.
# This line makes reloading the page a sufficient action to keep the
# session alive.
request.session.modified = True
user_profile = UserProfile.objects.get(user=request.user)
num_messages = UserMessage.objects.filter(user_profile=user_profile).count()