Skip to content
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

Redirect from pages that require auth on logout #1016

Merged
merged 3 commits into from
May 15, 2023

Conversation

SleeplessOne1917
Copy link
Member

I didn't make an issue for this one, but the code change does what the PR title says. Currently, if a user logs out of their account while on a page that requires auth (like /settings, /admin, /inbox, etc), they will not be navigated away from the page.

@@ -48,7 +48,15 @@ export class UserService {
this.myUserInfo = undefined;
IsomorphicCookie.remove("jwt"); // TODO is sometimes unreliable for some reason
document.cookie = "jwt=; Max-Age=0; path=/; domain=" + location.hostname;
location.reload();
if (
/create_.*|inbox|settings|setup|admin|reports|registration_applications/g.test(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth extracting this into a function and putting it in utils. It would help with what I called out on another PR.

@SleeplessOne1917 SleeplessOne1917 changed the title Redirect form pages that require auth on logout Redirect from pages that require auth on logout May 14, 2023
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good, thx.

@dessalines dessalines enabled auto-merge (squash) May 15, 2023 15:21
@dessalines dessalines merged commit d56d20d into LemmyNet:main May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants