WIP: active-sessions #93586
No reviewers
Labels
No Label
legacy project
Infrastructure: blender.org
legacy project
Infrastructure: Websites
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status::Confirmed
Status
Duplicate
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Report
Type
To Do
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: infrastructure/blender-id#93586
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "active-sessions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
A user needs to know how their account is being accessed/used.
At the very minimum, we need to display information about recent sign-ins and active sessions.
This PR adds a new "Active Sessions" page that lists existing sessions linked to a user, with an option to terminate a particular session.
Implementation
Builtin django sessions are lacking some essential features:
There are a few possible solutions to this:
bid_main_user_session
that would link to bothdjango_session
andbid_main_user
tables, and also have info about sign-in timestamp, IP and User-Agent.one downside is that
django_session
pk is a rather wide, varchar(40) column, and all session deletes need to cascade to the newbid_main_user_session
table via a FK constraint. this concern may be immaterialan upside is that the core functionality of sessions is not affected, and the cross-table can be easily extended for any future needs (e.g. if we decide to keep track of terminated sessions, recording their sign-out timestamp).
For now I am deliberating between a cross table and django-qsessions.
Switching to a different table drops logged-in state for all users.
We can populate the new table using the idea from https://github.com/jazzband/django-user-sessions/blob/master/user_sessions/management/commands/migratesessions.py but we won't have info about User-Agent, IP and create_at timestamp for old sessions (which is probably acceptable).
Deploy notes
After deploy run:
manage.py download_geoip_db -k mykey
d81974815a
to7cb8ed2b79
7cb8ed2b79
tob52564fb36
will be done in a different way: using a project-specific UserSession table
replacing this with #93587
Pull request closed