diff --git a/frontend/pages/email-not-verified.js b/frontend/pages/email-not-verified.tsx
similarity index 93%
rename from frontend/pages/email-not-verified.js
rename to frontend/pages/email-not-verified.tsx
index 11aec70bd4..3c634874af 100644
--- a/frontend/pages/email-not-verified.js
+++ b/frontend/pages/email-not-verified.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import Head from 'next/head';
-export default function Activity() {
+export default function EmailNotFeriviedPage() {
return (
diff --git a/frontend/pages/signup.tsx b/frontend/pages/signup.tsx
index 224a2b1022..d7a3960bf1 100644
--- a/frontend/pages/signup.tsx
+++ b/frontend/pages/signup.tsx
@@ -1,67 +1,24 @@
import { useEffect, useState } from "react";
-import ReactCodeInput from "react-code-input";
import Head from "next/head";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
-import { faCheck, faWarning, faX } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import Button from "~/components/basic/buttons/Button";
-import Error from "~/components/basic/Error";
-import InputField from "~/components/basic/InputField";
-import Aes256Gcm from "~/components/utilities/cryptography/aes-256-gcm";
-import issueBackupKey from "~/components/utilities/cryptography/issueBackupKey";
+import CodeInputStep from "~/components/signup/CodeInputStep";
+import DownloadBackupPDF from "~/components/signup/DonwloadBackupPDFStep";
+import EnterEmailStep from "~/components/signup/EnterEmailStep";
+import TeamInviteStep from "~/components/signup/TeamInviteStep";
+import UserInfoStep from "~/components/signup/UserInfoStep";
import { getTranslatedStaticProps } from "~/components/utilities/withTranslateProps";
-import attemptLogin from "~/utilities/attemptLogin";
-import passwordCheck from "~/utilities/checks/PasswordCheck";
import checkEmailVerificationCode from "./api/auth/CheckEmailVerificationCode";
-import completeAccountInformationSignup from "./api/auth/CompleteAccountInformationSignup";
-import sendVerificationEmail from "./api/auth/SendVerificationEmail";
import getWorkspaces from "./api/workspace/getWorkspaces";
-// const ReactCodeInput = dynamic(import("react-code-input"));
-const nacl = require("tweetnacl");
-const jsrp = require("jsrp");
-nacl.util = require("tweetnacl-util");
-const client = new jsrp.client();
-
-// The stye for the verification code input
-const props = {
- inputStyle: {
- fontFamily: "monospace",
- margin: "4px",
- MozAppearance: "textfield",
- width: "55px",
- borderRadius: "5px",
- fontSize: "24px",
- height: "55px",
- paddingLeft: "7",
- backgroundColor: "#0d1117",
- color: "white",
- border: "1px solid gray",
- textAlign: "center",
- },
-} as const;
-const propsPhone = {
- inputStyle: {
- fontFamily: "monospace",
- margin: "4px",
- MozAppearance: "textfield",
- width: "40px",
- borderRadius: "5px",
- fontSize: "24px",
- height: "40px",
- paddingLeft: "7",
- backgroundColor: "#0d1117",
- color: "white",
- border: "1px solid gray",
- textAlign: "center",
- },
-} as const;
+/**
+ * @returns the signup page
+ */
export default function SignUp() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
@@ -69,25 +26,9 @@ export default function SignUp() {
const [lastName, setLastName] = useState("");
const [code, setCode] = useState("");
const [codeError, setCodeError] = useState(false);
- const [firstNameError, setFirstNameError] = useState(false);
- const [lastNameError, setLastNameError] = useState(false);
- const [passwordErrorLength, setPasswordErrorLength] = useState(false);
- const [passwordErrorNumber, setPasswordErrorNumber] = useState(false);
- const [passwordErrorUpperCase, setPasswordErrorUpperCase] = useState(false);
- const [passwordErrorLowerCase, setPasswordErrorLowerCase] = useState(false);
- const [passwordErrorSpecialChar, setPasswordErrorSpecialChar] =
- useState(false);
- const [emailError, setEmailError] = useState(false);
- const [emailErrorMessage, setEmailErrorMessage] = useState("");
const [step, setStep] = useState(1);
const router = useRouter();
- const [errorLogin, setErrorLogin] = useState(false);
- const [isLoading, setIsLoading] = useState(false);
- const [isResendingVerificationEmail, setIsResendingVerificationEmail] =
- useState(false);
- const [backupKeyError, setBackupKeyError] = useState(false);
const [verificationToken, setVerificationToken] = useState("");
- const [backupKeyIssued, setBackupKeyIssued] = useState(false);
const { t } = useTranslation();
@@ -104,458 +45,28 @@ export default function SignUp() {
}, []);
/**
- * Goes to the following step (out of 3) of the signup process.
+ * Goes to the following step (out of 5) of the signup process.
* Step 1 is submitting your email
* Step 2 is Verifying your email with the code that you received
- * Step 3 is Giving the final info.
+ * Step 3 is asking the final info.
+ * Step 4 is downloading a backup pdf
+ * Step 5 is inviting users
*/
const incrementStep = async () => {
- if (step == 1) {
- setStep(2);
+ if (step == 1 || step == 3 || step == 4) {
+ setStep(step + 1);
} else if (step == 2) {
// Checking if the code matches the email.
const response = await checkEmailVerificationCode({ email, code });
- if (response.status === 200 || code == "111222") {
+ if (response.status === 200) {
setVerificationToken((await response.json()).token);
setStep(3);
} else {
setCodeError(true);
}
- } else if (step == 3) {
- setStep(4);
- }
- };
-
- /**
- * Verifies if the entered email "looks" correct
- */
- const emailCheck = () => {
- let emailCheckBool = false;
- if (!email) {
- setEmailError(true);
- setEmailErrorMessage("Please enter your email.");
- emailCheckBool = true;
- } else if (
- !email.includes("@") ||
- !email.includes(".") ||
- !/[a-z]/.test(email)
- ) {
- setEmailError(true);
- setEmailErrorMessage("Please enter a valid email.");
- emailCheckBool = true;
- } else {
- setEmailError(false);
- }
-
- // If everything is correct, go to the next step
- if (!emailCheckBool) {
- sendVerificationEmail(email);
- incrementStep();
- }
- };
-
- // Verifies if the imformation that the users entered (name, workspace) is there, and if the password matched the
- // criteria.
- const signupErrorCheck = async () => {
- setIsLoading(true);
- let errorCheck = false;
- if (!firstName) {
- setFirstNameError(true);
- errorCheck = true;
- } else {
- setFirstNameError(false);
- }
- if (!lastName) {
- setLastNameError(true);
- errorCheck = true;
- } else {
- setLastNameError(false);
- }
- errorCheck = passwordCheck({
- password,
- setPasswordErrorLength,
- setPasswordErrorNumber,
- setPasswordErrorLowerCase,
- currentErrorCheck: errorCheck,
- });
-
- if (!errorCheck) {
- // Generate a random pair of a public and a private key
- const pair = nacl.box.keyPair();
- const secretKeyUint8Array = pair.secretKey;
- const publicKeyUint8Array = pair.publicKey;
- const PRIVATE_KEY = nacl.util.encodeBase64(secretKeyUint8Array);
- const PUBLIC_KEY = nacl.util.encodeBase64(publicKeyUint8Array);
-
- const { ciphertext, iv, tag } = Aes256Gcm.encrypt({
- text: PRIVATE_KEY,
- secret: password
- .slice(0, 32)
- .padStart(
- 32 + (password.slice(0, 32).length - new Blob([password]).size),
- "0"
- ),
- }) as { ciphertext: string; iv: string; tag: string };
-
- localStorage.setItem("PRIVATE_KEY", PRIVATE_KEY);
-
- client.init(
- {
- username: email,
- password: password,
- },
- async () => {
- client.createVerifier(
- async (err: any, result: { salt: string; verifier: string }) => {
- const response = await completeAccountInformationSignup({
- email,
- firstName,
- lastName,
- organizationName: firstName + "'s organization",
- publicKey: PUBLIC_KEY,
- ciphertext,
- iv,
- tag,
- salt: result.salt,
- verifier: result.verifier,
- token: verificationToken,
- });
-
- // if everything works, go the main dashboard page.
- if (response.status === 200) {
- // response = await response.json();
-
- localStorage.setItem("publicKey", PUBLIC_KEY);
- localStorage.setItem("encryptedPrivateKey", ciphertext);
- localStorage.setItem("iv", iv);
- localStorage.setItem("tag", tag);
-
- try {
- await attemptLogin(
- email,
- password,
- setErrorLogin,
- router,
- true,
- false
- );
- incrementStep();
- } catch (error) {
- setIsLoading(false);
- }
- }
- }
- );
- }
- );
- } else {
- setIsLoading(false);
}
};
- const resendVerificationEmail = async () => {
- setIsResendingVerificationEmail(true);
- setIsLoading(true);
- await sendVerificationEmail(email);
- setTimeout(() => {
- setIsLoading(false);
- setIsResendingVerificationEmail(false);
- }, 2000);
- };
-
- // Step 1 of the sign up process (enter the email or choose google authentication)
- const step1 = (
-
-
-
- {'Let\''}s get started
-
-
-
-
- {/*
-
-
I do not want to receive emails about Infisical and its products.
-
*/}
-
-
- {t("signup:step1-privacy")}
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-
- // Step 2 of the signup process (enter the email verification code)
- const step2 = (
-
-
- {"We've"} sent a verification email to{" "}
-
-
- {email}{" "}
-
-
-
-
-
-
-
- {codeError && }
-
-
-
-
-
-
- Not seeing an email?
-
-
-
-
-
-
- {t("signup:step2-spam-alert")}
-
-
-
- );
-
- // Step 3 of the signup process (enter the rest of the impformation)
- const step3 = (
-
- );
-
- // Step 4 of the sign up process (download the emergency kit pdf)
- const step4 = (
-
-
- {t("signup:step4-message")}
-
-
-
{t("signup:step4-description1")}
-
{t("signup:step4-description2")}
-
-
-
- {t("signup:step4-description3")}
-
-
-
-
- );
-
return (
@@ -580,7 +91,11 @@ export default function SignUp() {
diff --git a/frontend/pages/signupinvite.js b/frontend/pages/signupinvite.js
index d32d6038d7..58a15e40de 100644
--- a/frontend/pages/signupinvite.js
+++ b/frontend/pages/signupinvite.js
@@ -349,7 +349,7 @@ export default function SignupInvite() {
setBackupKeyError,
setBackupKeyIssued
});
- router.push('/dashboard/');
+ router.push('/noprojects/');
}}
size="lg"
/>
diff --git a/frontend/public/locales/en/common.json b/frontend/public/locales/en/common.json
index c0b1e5640f..34cdcaea8c 100644
--- a/frontend/public/locales/en/common.json
+++ b/frontend/public/locales/en/common.json
@@ -13,8 +13,8 @@
"project-id": "Project ID",
"save-changes": "Save Changes",
"saved": "Saved",
- "drop-zone": "Drag and drop your .env file here.",
- "drop-zone-keys": "Drag and drop your .env file here to add more keys.",
+ "drop-zone": "Drag and drop a .env or .yml file here.",
+ "drop-zone-keys": "Drag and drop a .env or .yml file here to add more keys.",
"role": "Role",
"role_admin": "admin",
"display-name": "Display Name",
diff --git a/frontend/public/locales/en/dashboard.json b/frontend/public/locales/en/dashboard.json
index 99e6d9faa0..2638873602 100644
--- a/frontend/public/locales/en/dashboard.json
+++ b/frontend/public/locales/en/dashboard.json
@@ -10,6 +10,7 @@
"shared-description": "Shared keys are visible to your whole team",
"make-shared": "Make Shared",
"make-personal": "Make Personal",
+ "add-secret": "Add a new secret",
"check-docs": {
"button": "Check Docs",
"title": "Good job!",
diff --git a/frontend/public/locales/en/signup.json b/frontend/public/locales/en/signup.json
index 509520d56f..0fbc929516 100644
--- a/frontend/public/locales/en/signup.json
+++ b/frontend/public/locales/en/signup.json
@@ -17,5 +17,9 @@
"step4-description1": "If you get locked out of your account, your Emergency Kit is the only way to sign in.",
"step4-description2": "We recommend you download it and keep it somewhere safe.",
"step4-description3": "It contains your Secret Key which we cannot access or recover for you if you lose it.",
- "step4-download": "Download PDF"
+ "step4-download": "Download PDF",
+ "step5-send-invites": "Send Invites",
+ "step5-invite-team": "Invite your team",
+ "step5-subtitle": "Infisical is meant to be used with your teammates. Invite them to test it out.",
+ "step5-skip": "Skip"
}