-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Delete all sessions when calling Pow.Plug.delete_user/2
#404
Comments
May I ask a question about this? I have a custom controller in an admin panel to manage users (list - delete). I will maybe add But let's come back to my question about user deletion. If I understand correctly |
Correct, it's only when the user deletes the current user signed in, and deletes the associated session.
The session will still be active, so if you don't check if the user exists in the DB the user may be able to continue using the app until their session expire. #563 would resolve this. To remove all the sessions for the user it's necessary to call I wonder if permitting a second argument with the user to be deleted in |
Thanks for this clarification.
That would be great! ^^ |
Hey @danschultzer , I ran into this comment while I was looking for a way to clear up sessions in case a user updates their password. If I do We have a liveview page and getting the config from the socket was not working. The use case is in case a user account is compromised, and they chnaged the password we want preferably the other sessions to be deleted. Would it be possible to remove the reset_token as well? Thanks |
@benonymus I ended up doing something like this to clear out the session + the persistent session. Unfortunately, due to how persistent sessions are stored, there's no way except full enumeration to clear it out:
I think enumeration that doesn't load all (batch it) and using the actual store functions would make this better. I don't care about being generic though, so just winged it a bit :) |
Prompted by #386 (comment)
Currently
Pow.Plug.delete_user/2
callsdo_delete/2
for the plug, which only deletes the current session. However it should clear all sessions for the user. OnlyPow.Store.CredentialsCache
knows about related sessions which makes this tricky. Might work if a config value is passed on e.g.delete_all_for: user
.PowPersistentSession
might interfere with this. The way to resolve that is to delete all persistent session tokens that has a session fingerprint that's deleted. There could be a method inPowPersistentSession.Store.PersistentSessionCache
to do that, but it might also be a good idea to be able to look up all persistent sessions for the user.The text was updated successfully, but these errors were encountered: