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

Sessions: do not save on each request #9402

Merged
merged 1 commit into from
Jul 11, 2022
Merged

Sessions: do not save on each request #9402

merged 1 commit into from
Jul 11, 2022

Conversation

humitos
Copy link
Member

@humitos humitos commented Jul 6, 2022

Currently, we have a 30 days expiry time for cookies with "save on every request"
enabled. That means users won't need to re-login if they hit at least one Read
the Docs page every 30 days.

In an attempt to reduce this "infinit session time", I'm disabling the "save on
every request". This way we are forcing the users to re-login every 30 days --no
matter if they hit a Read the Docs page during that time or not.

This will help us to know what are the active users because we will be able to
check User.last_login and get reasonable numbers. With the current
configuration, a user that used the platform today could have a pretty old
last_login since we are not forcing re-login at all.

Discussion: https://github.com/readthedocs/meta/discussions/31

@humitos humitos requested a review from a team as a code owner July 6, 2022 08:54
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable. 15 days is pretty short, and might be annoying in some ways. I think it would be good if we could get to 30 days in the future, and perhaps just trigger a task automatically for users that have logged in login_days_ago % 7 = 0 or something?

@humitos
Copy link
Member Author

humitos commented Jul 7, 2022

@ericholscher

OK, I will put this back as it was: 30 days. I will create a task to do the resync as I wanted, as well.

Currently, we have a 30 days expiry time for cookies with "save on every request"
enabled. That means users won't need to re-login if they hit at least one Read
the Docs page every 30 days.

In an attempt to reduce this "infinit session time", I'm disabling the "save on
every request". This way we are forcing the users to re-login every 30 days --no
matter if they hit a Read the Docs page during that time or not.

This will help us to know what are the active users because we will be able to
check `User.last_login` and get reasonable numbers. With the current
configuration, a user that used the platform _today_ could have a pretty old
`last_login` since we are not forcing re-login at all.
@humitos
Copy link
Member Author

humitos commented Jul 7, 2022

I updated the commit message and the description as well

@humitos humitos changed the title Sessions: reduce age time and do not save on each request Sessions: do not save on each request Jul 7, 2022
humitos added a commit that referenced this pull request Jul 7, 2022
Copy the logic from `readthedocs-corporate` to resync `RemoteRepository` each
time the user logs in. We are forcing users to re-login every 30 days minimum.

Related: #9402
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good 👍

humitos added a commit that referenced this pull request Jul 11, 2022
Copy the logic from `readthedocs-corporate` to resync `RemoteRepository` each
time the user logs in. We are forcing users to re-login every 30 days minimum.

Related: #9402
@humitos humitos merged commit 2eda61c into main Jul 11, 2022
@humitos humitos deleted the humitos/session-cookie branch July 11, 2022 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants