-
Notifications
You must be signed in to change notification settings - Fork 0
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 logout cookie #153
Delete logout cookie #153
Conversation
255eb3a
to
c04c8b9
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.
I suspect this would cause logout issues when used on a website which has caching plugin, so might be safer to always load the logout script file and not based on cookie check. To expand on it, imagine a WP site with logout redirection to homepage and has a caching plugin so homepage load never really checks for cookie presence for loading logout script.
Also, we have another problem with the logout. Inside logoutSession()
fetch doesn't reject a 403 http request by design, so a failed logout attempt is considered as a success.
In sites with caching, page would not necessarily contain the script. We want to make sure script always runs. It's a very small script, around 500 bytes.
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.
Looks good!
When the user logs out of WordPress, a
chatrix-logout
cookie is set, which will result in thelogout.ts
script runing, which logs out matrix sessions, and deletes all chatrix data in the browser.However, this cookie wasn't beeing expired after sessions had been logged out, which would result in the script running on all page loads (until the cookie expires). This PR fixes that by expiring the cookie once sessions have been logged out and data deleted.
Addiitionally, as suggested by @ashfame, the logout script is now only being enqueued when thechatrix-logout
cookie exists.