fix: Publicly shared pages redirect to login
This commit is contained in:
@@ -26,6 +26,7 @@ import SearchQuery from "~/models/SearchQuery";
|
||||
import KeyboardShortcuts from "~/scenes/KeyboardShortcuts";
|
||||
import { createAction } from "~/actions";
|
||||
import { NavigationSection, RecentSearchesSection } from "~/actions/sections";
|
||||
import env from "~/env";
|
||||
import Desktop from "~/utils/Desktop";
|
||||
import history from "~/utils/history";
|
||||
import isCloudHosted from "~/utils/isCloudHosted";
|
||||
@@ -211,6 +212,9 @@ export const logout = createAction({
|
||||
icon: <LogoutIcon />,
|
||||
perform: () => {
|
||||
void stores.auth.logout();
|
||||
if (env.OIDC_LOGOUT_URI) {
|
||||
window.location.replace(env.OIDC_LOGOUT_URI);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import * as React from "react";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import env from "~/env";
|
||||
import useStores from "~/hooks/useStores";
|
||||
|
||||
const Logout = () => {
|
||||
const { auth } = useStores();
|
||||
void auth.logout();
|
||||
if (env.OIDC_LOGOUT_URI) {
|
||||
window.location.replace(env.OIDC_LOGOUT_URI);
|
||||
return null;
|
||||
}
|
||||
return <Redirect to="/" />;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import { PartialWithId } from "~/types";
|
||||
import { client } from "~/utils/ApiClient";
|
||||
import Desktop from "~/utils/Desktop";
|
||||
import Logger from "~/utils/Logger";
|
||||
import history from "~/utils/history";
|
||||
import isCloudHosted from "~/utils/isCloudHosted";
|
||||
import Store from "./base/Store";
|
||||
|
||||
@@ -353,11 +352,6 @@ export default class AuthStore extends Store<Team> {
|
||||
// Tell the host application we logged out, if any – allows window cleanup.
|
||||
if (Desktop.isElectron()) {
|
||||
void Desktop.bridge?.onLogout?.();
|
||||
} else if (env.OIDC_LOGOUT_URI) {
|
||||
window.location.replace(env.OIDC_LOGOUT_URI);
|
||||
return;
|
||||
}
|
||||
|
||||
history.replace("/");
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user