mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 07:27:58 +00:00
Merge pull request #2656 from scott-ray-wilson/insecure-context-banner
Feature: Display Warning Banner for Insecure Connection
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 { useUpdateUserProjectFavorites } from "@app/hooks/api/users/mutation";
|
||||||
import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
|
import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
|
||||||
import { AuthMethod } from "@app/hooks/api/users/types";
|
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 { navigateUserToOrg } from "@app/views/Login/Login.utils";
|
||||||
import { Mfa } from "@app/views/Login/Mfa";
|
import { Mfa } from "@app/views/Login/Mfa";
|
||||||
import { CreateOrgModal } from "@app/views/Org/components";
|
import { CreateOrgModal } from "@app/views/Org/components";
|
||||||
@@ -361,6 +362,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="dark hidden h-screen w-full flex-col overflow-x-hidden md:flex">
|
<div className="dark hidden h-screen w-full flex-col overflow-x-hidden md:flex">
|
||||||
|
{!window.isSecureContext && <InsecureConnectionBanner />}
|
||||||
<div className="flex flex-grow flex-col overflow-y-hidden md:flex-row">
|
<div className="flex flex-grow flex-col overflow-y-hidden md:flex-row">
|
||||||
<aside className="dark w-full border-r border-mineshaft-600 bg-gradient-to-tr from-mineshaft-700 via-mineshaft-800 to-mineshaft-900 md:w-60">
|
<aside className="dark w-full border-r border-mineshaft-600 bg-gradient-to-tr from-mineshaft-700 via-mineshaft-800 to-mineshaft-900 md:w-60">
|
||||||
<nav className="items-between flex h-full flex-col justify-between overflow-y-auto dark:[color-scheme:dark]">
|
<nav className="items-between flex h-full flex-col justify-between overflow-y-auto dark:[color-scheme:dark]">
|
||||||
|
|||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { faWarning, faXmark } 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="flex w-screen items-start border-b border-red-900 bg-red-700 py-1 px-2 font-inter text-sm text-mineshaft-200">
|
||||||
|
<FontAwesomeIcon className="ml-3.5 mt-1" icon={faWarning} />
|
||||||
|
<span className="mx-1 ml-2 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={faXmark} />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./InsecureConnectionBanner";
|
||||||
Reference in New Issue
Block a user