From a9bd878057042c764ec76563bd2eff80736c59d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Mar=C3=ADn?= Date: Fri, 9 Dec 2022 22:18:20 +0100 Subject: [PATCH 01/29] Updated the start developing guide --- docs/contributing/developing.mdx | 39 ++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/docs/contributing/developing.mdx b/docs/contributing/developing.mdx index b6c25861c0..af321dea2e 100644 --- a/docs/contributing/developing.mdx +++ b/docs/contributing/developing.mdx @@ -16,17 +16,48 @@ cd infisical ## Set up environment variables -Tweak the `.env` according to your preferences. Refer to the available [environment variables](/self-hosting/configuration/envars). +Before running the docker-compose we have to generate the .env file with the environment variables, you can create your own file or start with the +`.env.example` as an example guide. + +Mandatory variables in the `.env` file: + +1. Keys and JWT variables + +![image](https://user-images.githubusercontent.com/118568289/206791534-9c9d1431-e83d-49c0-8a54-b373ed0df820.png) + +The `.env.example` has these variables empty, you can self generate the `JWT and ENCRYPTION_KEY` with this [32-byte random hex strings generator](https://www.browserling.com/tools/random-hex). + +For the `PRIVATE_KEY and PUBLIC_KEY` you can use the ones shown in the screenshot: -```bash -cp .env.example .env ``` +PRIVATE_KEY='oGVv5rThrpZ7WLgQW27chY1cXngr4wLQIZnGfSKgHPk=' +PUBLIC_KEY='ldr6JaC7AY+tun3omGLdE4SWpkJbtVBOI54KfUP53Xc=' +``` + +2. Mongo variables and site URL + +![image](https://user-images.githubusercontent.com/118568289/206792171-3376e3c6-c3ac-4d5d-8776-d78ee089b520.png) + +These variables are used to connect the MongoDB and set the URL for the localhost. + +3. Mail SMTP service variables + +![image](https://user-images.githubusercontent.com/118568289/206792653-ba3211d1-1071-43f2-93a7-8b408bbd9e0e.png) + +These variables are needed to use the Mail SMTP service that takes care of sending the verification code when you +register in the app. + +For the `SMTP_USERNAME` variable, you will need an email with 2-steps-verification. + +For the `SMTP_PASSWORD` variable, you will need to [generate an app password](https://support.google.com/mail/answer/185833?hl=en) with the email you used in the `SMTP_USERNAME` variable. + +With this environment variables, you will be ready to run the docker-compose. ## Docker for development ```bash # build and start the services -docker-compose -f docker-compose.dev.yml up --build +docker-compose -f docker-compose.dev.yml up --build --force-recreate ``` Then browse http://localhost:8080 From 9ee0c8f1b73287130de4815e9f2295a37df3123a Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Fri, 9 Dec 2022 17:20:17 -0500 Subject: [PATCH 02/29] Fixed typescript issue for signupinvites --- frontend/pages/settings/personal/[id].js | 6 +++--- frontend/pages/signupinvite.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/pages/settings/personal/[id].js b/frontend/pages/settings/personal/[id].js index 928d426b0e..070f547e40 100644 --- a/frontend/pages/settings/personal/[id].js +++ b/frontend/pages/settings/personal/[id].js @@ -125,13 +125,13 @@ export default function PersonalSettings() { label="New Password" onChangeHandler={(password) => { setNewPassword(password); - passwordCheck( + passwordCheck({ password, setPasswordErrorLength, setPasswordErrorNumber, setPasswordErrorLowerCase, - false - ); + currentErrorCheck: false, + }); }} type="password" value={newPassword} diff --git a/frontend/pages/signupinvite.js b/frontend/pages/signupinvite.js index 15c5117395..0de60f855e 100644 --- a/frontend/pages/signupinvite.js +++ b/frontend/pages/signupinvite.js @@ -204,13 +204,13 @@ export default function SignupInvite() { label="Password" onChangeHandler={(password) => { setPassword(password); - passwordCheck( + passwordCheck({ password, setPasswordErrorLength, setPasswordErrorNumber, setPasswordErrorLowerCase, - false - ); + currentErrorCheck: false, + }); }} type="password" value={password} From f49fe3962db3002bc8ddd5231b10035d15ff0de8 Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Fri, 9 Dec 2022 18:02:22 -0500 Subject: [PATCH 03/29] Added progress bar for the Infisical Guide --- frontend/components/basic/Layout.tsx | 63 +++++++++++++++++++++++++- frontend/public/images/progress-0.svg | 5 ++ frontend/public/images/progress-14.svg | 6 +++ frontend/public/images/progress-28.svg | 5 ++ frontend/public/images/progress-43.svg | 5 ++ frontend/public/images/progress-57.svg | 5 ++ 6 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 frontend/public/images/progress-0.svg create mode 100644 frontend/public/images/progress-14.svg create mode 100644 frontend/public/images/progress-28.svg create mode 100644 frontend/public/images/progress-43.svg create mode 100644 frontend/public/images/progress-57.svg diff --git a/frontend/components/basic/Layout.tsx b/frontend/components/basic/Layout.tsx index 4a40fdef08..819a87db01 100644 --- a/frontend/components/basic/Layout.tsx +++ b/frontend/components/basic/Layout.tsx @@ -21,6 +21,7 @@ import addUserToWorkspace from "~/pages/api/workspace/addUserToWorkspace"; import createWorkspace from "~/pages/api/workspace/createWorkspace"; import getWorkspaces from "~/pages/api/workspace/getWorkspaces"; import uploadKeys from "~/pages/api/workspace/uploadKeys"; +import checkUserAction from "~/pages/api/userActions/checkUserAction"; import NavBarDashboard from "../navigation/NavBarDashboard"; import { tempLocalStorage } from "../utilities/checks/tempLocalStorage"; @@ -45,6 +46,11 @@ export default function Layout({ children }: LayoutProps) { const [isOpen, setIsOpen] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(false); + const [hasUserClickedSlack, setHasUserClickedSlack] = useState(false); + const [hasUserClickedIntro, setHasUserClickedIntro] = useState(false); + const [hasUserStarred, setHasUserStarred] = useState(false); + const [usersInOrg, setUsersInOrg] = useState(false); + const [totalOnboardingActionsDone, setTotalOnboardingActionsDone] = useState(0); function closeModal() { setIsOpen(false); @@ -211,6 +217,46 @@ export default function Layout({ children }: LayoutProps) { } }; putUserInWorkSpace(); + + const checkUserActionsFunction = async () => { + let countActions = 0; + const userActionSlack = await checkUserAction({ + action: "slack_cta_clicked", + }); + setHasUserClickedSlack(userActionSlack ? true : false); + if (userActionSlack) { + countActions = countActions + 1; + } + + const userActionIntro = await checkUserAction({ + action: "intro_cta_clicked", + }); + setHasUserClickedIntro(userActionIntro ? true : false); + if (userActionIntro) { + countActions = countActions + 1; + } + + const userActionStar = await checkUserAction({ + action: "star_cta_clicked", + }); + setHasUserStarred(userActionStar ? true : false); + if (userActionStar) { + countActions = countActions + 1; + } + + const orgId = localStorage.getItem("orgData.id"); + const orgUsers = await getOrganizationUsers({ + orgId: orgId ? orgId : "", + }); + setUsersInOrg(orgUsers.length > 1) + if (orgUsers.length > 1) { + countActions = countActions + 1; + } + console.log(123, countActions) + setTotalOnboardingActionsDone(countActions); + }; + console.log(`images/progress-${totalOnboardingActionsDone == 0 ? "0" : ""}${totalOnboardingActionsDone == 1 ? "14" : ""}${totalOnboardingActionsDone == 1 ? "28" : ""}${totalOnboardingActionsDone == 3 ? "43" : ""}${totalOnboardingActionsDone == 4 ? "57" : ""}.svg`) + checkUserActionsFunction(); }, []); useEffect(() => { @@ -240,6 +286,7 @@ export default function Layout({ children }: LayoutProps) { return ( <>
+
) : (

Infisical Guide + progress bar
)} diff --git a/frontend/public/images/progress-0.svg b/frontend/public/images/progress-0.svg new file mode 100644 index 0000000000..8d338b719c --- /dev/null +++ b/frontend/public/images/progress-0.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/public/images/progress-14.svg b/frontend/public/images/progress-14.svg new file mode 100644 index 0000000000..33d8522b93 --- /dev/null +++ b/frontend/public/images/progress-14.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/frontend/public/images/progress-28.svg b/frontend/public/images/progress-28.svg new file mode 100644 index 0000000000..59273c32b0 --- /dev/null +++ b/frontend/public/images/progress-28.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/public/images/progress-43.svg b/frontend/public/images/progress-43.svg new file mode 100644 index 0000000000..fd963c69e4 --- /dev/null +++ b/frontend/public/images/progress-43.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/public/images/progress-57.svg b/frontend/public/images/progress-57.svg new file mode 100644 index 0000000000..e878c20491 --- /dev/null +++ b/frontend/public/images/progress-57.svg @@ -0,0 +1,5 @@ + + + + + From cd70128ff862c3dd2503df683543f747634683ae Mon Sep 17 00:00:00 2001 From: arjunyel Date: Fri, 9 Dec 2022 17:23:02 -0600 Subject: [PATCH 04/29] Add autocomplete to sign in/up forms --- frontend/components/basic/InputField.tsx | 9 ++++++++- frontend/pages/login.js | 3 +++ frontend/pages/settings/personal/[id].js | 6 ++++++ frontend/pages/signup.tsx | 5 +++++ frontend/pages/signupinvite.js | 4 ++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/frontend/components/basic/InputField.tsx b/frontend/components/basic/InputField.tsx index 02bb8a8cc8..139304ea6a 100644 --- a/frontend/components/basic/InputField.tsx +++ b/frontend/components/basic/InputField.tsx @@ -21,7 +21,10 @@ interface InputFieldProps { onChangeHandler: (value: string) => void; } -const InputField = (props: InputFieldProps) => { +const InputField = ( + props: InputFieldProps & + Pick +) => { const [passwordVisible, setPasswordVisible] = useState(false); const router = useRouter(); @@ -43,6 +46,8 @@ const InputField = (props: InputFieldProps) => { className="bg-bunker-800 text-gray-400 border border-gray-600 rounded-md text-md p-2 w-full min-w-16 outline-none" name={props.name} readOnly + autoComplete={props.autoComplete} + id={props.id} />
); @@ -88,6 +93,8 @@ const InputField = (props: InputFieldProps) => { } relative peer bg-bunker-800 rounded-md text-gray-400 text-md p-2 w-full min-w-16 outline-none focus:ring-4 duration-200`} name={props.name} spellCheck="false" + autoComplete={props.autoComplete} + id={props.id} /> {props.label?.includes("Password") && (