Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout Django sessions #2159

Merged
merged 4 commits into from Jun 13, 2014

Conversation

rtibbles
Copy link
Member

Fixes #2000

Summary of changes:

  • Adds middleware to check last active time.
  • Adds listener to logout event to end UserLog logging.
  • Adds default 20 minute setting for session timeout.

@aronasorman and @dylanjbarth, please take a look.

current_datetime = datetime.datetime.now()

# Timeout if idle time period is exceeded.
if request.session.has_key('last_activity') and \

This comment was marked as spam.

@aronasorman
Copy link
Collaborator

Looks good. Can you write a test for this?

@rtibbles
Copy link
Member Author

Don't understand the test failure above. Only happened after linting fix, and only in 2.6, not 2.7.

@aronasorman
Copy link
Collaborator

I had Travis restart that specific job. It's passing now.

aronasorman added a commit that referenced this pull request Jun 13, 2014
@aronasorman aronasorman merged commit 2b2c2c7 into learningequality:release-0.12.0 Jun 13, 2014
@mikewray
Copy link

Hi there - sorry to report the number of logins is still not be recorded correctly. In my test over the last few days I logged in and out as different types of users, very soon the login count stops despite continual activity - I seperated the activity, logging in the following day or a few hours later. I have always logged out cleanly (unless the auto logout gets me before, so that's working). The actual activity is recorded fine and you can see when the user last did things.

I got a strange inkling but enough to prove it yet - does the count get jammed if a user logs in more than once in a day and once that happens its then stuck? I will start a test now for this and report back.

@rtibbles
Copy link
Member Author

Thanks for letting us know @mikewray - seems like there are still some odd things happening here. I've created a separate issue for this: #2276. Will be looking into it later in the week.

@mikewray
Copy link

mikewray commented Aug 8, 2014

Hi there, just checking on this issue - any progress or need my help?

@rtibbles
Copy link
Member Author

rtibbles commented Aug 8, 2014

Did you have a chance to look if it was the potential issue you highlighted
above of users logging in more than once a day?

On Fri, Aug 8, 2014 at 1:08 PM, mikewray notifications@github.com wrote:

Hi there, just checking on this issue - any progress or need my help?


Reply to this email directly or view it on GitHub
#2159 (comment)
.

Richard

@mikewray
Copy link

mikewray commented Aug 8, 2014

Mmmm...I did not. I will try test. Easy to do if you change the date on device. Will report back.

@mikewray
Copy link

Ok so I tested:

  1. Created a new user and went and did an exercise. Logged out. The number of logins reflected as 1 - ok
  2. I changed the date on the system to the next day, logged in as the new user again and did an exercise then logged out again. Number of logins still reflects 1

3.Change the date again to the following and do the same, login stays as 1. So my theory fails.

There are definitely users in the system have more than one login in the system but something is jamming up somewhere. I can't confirm once the login count stops it does not budge again but that may be the case. I dunno...something not right. Let me know how else I can help?

@mikewray
Copy link

Hi there, just checking on this - any progress or anything I can do to help? Tx!

@rtibbles rtibbles self-assigned this Aug 27, 2014
@rtibbles
Copy link
Member Author

Hi @mikewray - I have just finished up some other work. Will look at this by the end of the week and report back.

@cpauya
Copy link
Contributor

cpauya commented Oct 7, 2014

This is working as per findings on the #2000 issue. The "number of login" issue can be fixed by #2276.

@aronasorman I think we can close this now.

@aronasorman aronasorman deleted the session_timeout branch October 8, 2014 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants