Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
FieldLabel,
Input
} from "@app/components/v3";
import { useCreateOrg, useSelectOrganization } from "@app/hooks/api";
import { useCreateOrg, useLogoutUser, useSelectOrganization } from "@app/hooks/api";
import { GenericResourceNameSchema } from "@app/lib/schemas";

const schema = z
Expand Down Expand Up @@ -52,6 +52,7 @@ export const CreateOrgModal: FC<CreateOrgModalProps> = ({ isOpen, onClose }) =>
invalidate: false
});
const { mutateAsync: selectOrg } = useSelectOrganization();
const logout = useLogoutUser();

const onFormSubmit = async ({ name }: FormData) => {
const organization = await createOrg({ name });
Expand Down Expand Up @@ -120,6 +121,17 @@ export const CreateOrgModal: FC<CreateOrgModalProps> = ({ isOpen, onClose }) =>
Create
</Button>
</DialogFooter>
{!onClose && (
<div className="mt-4 text-center">
<button
type="button"
className="text-sm text-mineshaft-400 underline-offset-4 hover:text-mineshaft-200 hover:underline"
onClick={() => logout.mutate()}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Redirect user to login after logout action

Clicking the new "Log out" control only calls logout.mutate() and never navigates away, so in the NoOrgPage flow (CreateOrgModal rendered without onClose) the user can remain on /_authenticate/organizations/none even after session state is cleared. Because auth checks for this route run in beforeLoad on navigation, the page does not automatically re-run access control here; this leaves users on an authenticated route with a logged-out session until a manual refresh/navigation happens. Align this path with other logout handlers by awaiting logout and explicitly routing to /login.

Useful? React with 👍 / 👎.

>
Log out
</button>
</div>
)}
</form>
</DialogContent>
</Dialog>
Expand Down
Loading