mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-29 22:02:57 +00:00
feature: display warning banner for insecure context
This commit is contained in:
@ -82,6 +82,7 @@ import { Workspace } from "@app/hooks/api/types";
|
||||
import { useUpdateUserProjectFavorites } from "@app/hooks/api/users/mutation";
|
||||
import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
|
||||
import { AuthMethod } from "@app/hooks/api/users/types";
|
||||
import { InsecureConnectionBanner } from "@app/layouts/AppLayout/components/InsecureConnectionBanner";
|
||||
import { navigateUserToOrg } from "@app/views/Login/Login.utils";
|
||||
import { Mfa } from "@app/views/Login/Mfa";
|
||||
import { CreateOrgModal } from "@app/views/Org/components";
|
||||
@ -1023,6 +1024,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
||||
onClose={() => handlePopUpToggle("createOrg", false)}
|
||||
/>
|
||||
<main className="flex-1 overflow-y-auto overflow-x-hidden bg-bunker-800 dark:[color-scheme:dark]">
|
||||
{!window.isSecureContext && <InsecureConnectionBanner />}
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
|
@ -0,0 +1,37 @@
|
||||
import { useState } from "react";
|
||||
import { faWarning, faX } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
import { IconButton } from "@app/components/v2";
|
||||
|
||||
export const InsecureConnectionBanner = () => {
|
||||
const [isAcknowledged, setIsAcknowledged] = useState(
|
||||
localStorage.getItem("insecureConnectionAcknowledged") ?? false
|
||||
);
|
||||
|
||||
const handleDismiss = () => {
|
||||
setIsAcknowledged(true);
|
||||
localStorage.setItem("insecureConnectionAcknowledged", "true");
|
||||
};
|
||||
|
||||
if (isAcknowledged) return null;
|
||||
|
||||
return (
|
||||
<div className="sticky top-0 z-50 flex w-full items-start bg-red-700 py-1 px-2 font-inter text-sm text-mineshaft-200">
|
||||
<FontAwesomeIcon className="mt-1" icon={faWarning} />
|
||||
<span className="mx-1 mt-[0.04rem]">
|
||||
Your connection to this Infisical instance is not secured via HTTPS. Some features may not
|
||||
behave as expected.
|
||||
</span>
|
||||
<IconButton
|
||||
size="xs"
|
||||
className="ml-auto"
|
||||
colorSchema="danger"
|
||||
onClick={handleDismiss}
|
||||
ariaLabel="Dismiss banner"
|
||||
>
|
||||
<FontAwesomeIcon icon={faX} />
|
||||
</IconButton>
|
||||
</div>
|
||||
);
|
||||
};
|
@ -0,0 +1 @@
|
||||
export * from "./InsecureConnectionBanner";
|
Reference in New Issue
Block a user