-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove support for legacy user sessions #4540
Conversation
f07bb80
to
1281509
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great
def revoke_all_user_sessions(user) do | ||
{_count, tokens} = | ||
Repo.delete_all( | ||
from us in Auth.UserSession, where: us.user_id == ^user.id, select: us.token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select is probably unnecessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select
here makes the DELETE query return tokens without selecting them separately - they are then iterated over to broadcast "disconnect LV" message.
) | ||
|
||
Enum.each(tokens, fn token -> | ||
PlausibleWeb.Endpoint.broadcast(live_socket_id(token), "disconnect", %{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! awaiting empd integration 🤘 is this a built-in message that's handled elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
The change got reverted. We are going to address this separately together with a proper server error response handling on FE side. |
This reverts commit 77d1a10.
77d1a10
to
c7bb860
Compare
Changes
This PR removes support for legacy sessions entirely. They are treated the same as "no valid token" case.
Additionally, on password reset, all user's sessions are deleted and their LV sockets are disconnected (note: this has limited effect when the pubsub is not connected between the nodes in multi-node scenario).
Tests