Repository navigation
Add ability to view and terminate user sessions - #3664
Merged
Merged
Conversation
Adds a dashboard in user preferences to enable users to see all logged-in sessions under their account, and terminate any if they choose to do so. Also renames 2FA page to "Security Settings" since it seemed reasonable to put these two functionalities together. Because we use the cache engine for sessions, we can't efficiently check directly for all a user's sessions. Instead we add an object to a new UserSession model the first time they log in to a session. On logout, the actual session is terminated, and we delete the model object. Because sessions can expire, we check all associated sessions for a user's UserSession objects when they load the security page and remove any that no longer have active sessions. Existing sessions when this is first rolled out will not appear in the dashboard since they won't have a UserSession object. Once they expire, this problem will resolve itself.
hughrun
requested review from
dato and
mouse-reeve
and removed request for
dato
August 11, 2025 07:01
dato
approved these changes
Aug 21, 2025
dato
left a comment
Contributor
There was a problem hiding this comment.
Great work! π
I ran this on my test instance, it worked as documented.
Please find some review comments below.
dato
reviewed
Aug 21, 2025
dato
reviewed
Aug 22, 2025
fix abbr Co-authored-by: Adeodato SimΓ³ <73768+dato@users.noreply.github.com>
rationalise ua_parser usage Co-authored-by: Adeodato SimΓ³ <73768+dato@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a dashboard in user preferences to enable users to see all logged-in sessions under their account, and terminate any if they choose to do so.
Also renames 2FA page to "Security Settings" since it seemed reasonable to put these two functionalities together.
Because we use the cache engine for sessions, we can't efficiently check directly for all a user's sessions. Instead we add an object to a new UserSession model the first time they log in to a session. On logout, the actual session is terminated, and we delete the model object. Because sessions can expire, we check all associated sessions for a user's UserSession objects when they load the security page and remove any that no longer have active sessions.
Existing sessions when this is first rolled out will not appear in the dashboard since they won't have a UserSession object. Once they expire, this problem will resolve itself.
Users can't accidentally log out their current session ;)
This also changes the default session age to 365 days.
What type of Pull Request is this?
Does this PR change settings or dependencies, or break something?
Details of breaking or configuration changes (if any of above checked)
Documentation
Tests