-
Notifications
You must be signed in to change notification settings - Fork 60
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
MM-918 [WIP]: Invalidate all user sessions after password change #64
base: master
Are you sure you want to change the base?
Conversation
Context.refreshAuthenticatedUser(); | ||
request.getSession().invalidate(); |
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.
Does this forcibly log the user out? (I don't think that's desirable behaviour)
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.
Does this forcibly log the user out?
Yes @ibacher The user is forcefully logged out. Thank you
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.
maybe i should remove line 115 and add the code below to logout the user using the context so that he is redirected to the login screen. What is the better option?
Context.logout();
request.getSession().invalidate();
request.getSession().setAttribute("manual-logout", "true");
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.
I mean, the real ideal would be if there's a way for a user to change their password and have the session continue uninterrupted, but, yeah, if we're going to log the user out, maybe just do the whole thing. We could even add a redirect to the login page here?
I came across this when i was trying to find out why different sessions exist after a password change. Before: 06.08.2021_17.56.19_REC.mp4After: 06.08.2021_17.45.47_REC.mp4 |
@jnsereko Thanks for the videos. So it looks like we're logging the user out anyways, I suppose we might as well continue with that behaviour. |
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.
Thanks @jnsereko
I also think it would be a good idea to redirect to login after a password change, if that doesn't already happen automatically.
Also, let's try to take this one step further and invalidate all the user's active sessions (e.g. on different browsers, or on different devices) on a password change. Do you think you can incorporate any of the ideas from this PR: openmrs/openmrs-module-webservices.rest#486 ?
Hey @isears @ibacher. Thanks for the review
My own worry is that after password change, I wanted to display a
This is really helpful @isears, thank you |
756764b
to
954e4ee
Compare
I have added some changes but this PR depends on openmrs/openmrs-module-legacyui#171 |
@jnsereko If this depends on something in the legacyui, that's an argument to move it into core. |
so this fix corrects two bugs:
session.invalidation.mp4 |
This issue is still in development :
Every time a user changes his/her password, so long as he/she has not clicked the logout link, he/she can still login using his/her previous password.
cc @isears @sherrif10 @ibacher @dkayiwa