Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: checkpoint

=80395606c2e9
diff --git a/frontend/src/hooks/api/account-recovery/index.tsx b/frontend/src/hooks/api/account-recovery/index.tsx
new file mode 100644
index 0000000000..7cf76eb331
--- /dev/null
+++ b/frontend/src/hooks/api/account-recovery/index.tsx
@@ -0,0 +1 @@
+export { useSendAccountRecoveryEmail, useVerifyAccountRecoveryEmail } from "./mutation";
diff --git a/frontend/src/hooks/api/account-recovery/mutation.tsx b/frontend/src/hooks/api/account-recovery/mutation.tsx
new file mode 100644
index 0000000000..2d9733c8a5
--- /dev/null
+++ b/frontend/src/hooks/api/account-recovery/mutation.tsx
@@ -0,0 +1,37 @@
+import { useMutation } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import {
+ TSendAccountRecoveryEmailDTO,
+ TVerifyAccountRecoveryEmailDTO,
+ TVerifyAccountRecoveryEmailResponse
+} from "./types";
+
+export const useSendAccountRecoveryEmail = () => {
+ return useMutation({
+ mutationFn: async ({ email }: TSendAccountRecoveryEmailDTO) => {
+ const { data } = await apiRequest.post("/api/v1/account-recovery/send-email", {
+ email
+ });
+
+ return data;
+ }
+ });
+};
+
+export const useVerifyAccountRecoveryEmail = () => {
+ return useMutation({
+ mutationFn: async ({ email, code }: TVerifyAccountRecoveryEmailDTO) => {
+ const { data } = await apiRequest.post<TVerifyAccountRecoveryEmailResponse>(
+ "/api/v1/account-recovery/verify-email",
+ {
+ email,
+ code
+ }
+ );
+
+ return data;
+ }
+ });
+};
diff --git a/frontend/src/hooks/api/account-recovery/types.ts b/frontend/src/hooks/api/account-recovery/types.ts
new file mode 100644
index 0000000000..567e28f484
--- /dev/null
+++ b/frontend/src/hooks/api/account-recovery/types.ts
@@ -0,0 +1,15 @@
+import { UserEncryptionVersion } from "../auth/types";
+
+export type TSendAccountRecoveryEmailDTO = {
+ email: string;
+};
+
+export type TVerifyAccountRecoveryEmailDTO = {
+ email: string;
+ code: string;
+};
+
+export type TVerifyAccountRecoveryEmailResponse = {
+ token: string;
+ userEncryptionVersion: UserEncryptionVersion;
+};
diff --git a/frontend/src/hooks/api/auth/index.tsx b/frontend/src/hooks/api/auth/index.tsx
index 392f7b1f57..cf7a32e436 100644
--- a/frontend/src/hooks/api/auth/index.tsx
+++ b/frontend/src/hooks/api/auth/index.tsx
@@ -6,9 +6,7 @@ export {
useResetUserPasswordV2,
useSelectOrganization,
useSendMfaToken,
- useSendPasswordResetEmail,
useSendVerificationEmail,
useVerifyMfaToken,
- useVerifyPasswordResetCode,
useVerifySignupEmailVerificationCode
} from "./queries";
diff --git a/frontend/src/hooks/api/auth/queries.tsx b/frontend/src/hooks/api/auth/queries.tsx
index 539397aa98..b4b002c610 100644
--- a/frontend/src/hooks/api/auth/queries.tsx
+++ b/frontend/src/hooks/api/auth/queries.tsx
@@ -29,7 +29,6 @@ import {
SetupPasswordDTO,
TOauthTokenExchangeDTO,
UserAgentType,
- UserEncryptionVersion,
VerifyMfaTokenDTO,
VerifyMfaTokenRes,
VerifySignupInviteDTO
@@ -223,34 +222,6 @@ export const useVerifySignupEmailVerificationCode = () => {
});
};
-export const useSendPasswordResetEmail = () => {
- return useMutation({
- mutationFn: async ({ email }: { email: string }) => {
- const { data } = await apiRequest.post("/api/v1/password/email/password-reset", {
- email
- });
-
- return data;
- }
- });
-};
-
-export const useVerifyPasswordResetCode = () => {
- return useMutation({
- mutationFn: async ({ email, code }: { email: string; code: string }) => {
- const { data } = await apiRequest.post<{
- token: string;
- userEncryptionVersion: UserEncryptionVersion;
- }>("/api/v1/password/email/password-reset-verify", {
- email,
- code
- });
-
- return data;
- }
- });
-};
-
export const getBackupEncryptedPrivateKey = async ({
verificationToken
}: GetBackupEncryptedPrivateKeyDTO) => {
diff --git a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
index d4c8eb78e2..065801a834 100644
--- a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
+++ b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
@@ -440,7 +440,7 @@ export const InitialStep = ({
<div className="mt-2 flex flex-row text-sm text-bunker-400">
<Link to="/verify-email">
<span className="cursor-pointer duration-200 hover:text-bunker-200 hover:underline hover:decoration-primary-700 hover:underline-offset-4">
- Forgot password? Recover your account
+ Recover your account
</span>
</Link>
</div>
diff --git a/frontend/src/pages/auth/VerifyEmailPage/VerifyEmailPage.tsx b/frontend/src/pages/auth/VerifyEmailPage/AccountRecoveryPage.tsx
similarity index 91%
rename from frontend/src/pages/auth/VerifyEmailPage/VerifyEmailPage.tsx
rename to frontend/src/pages/auth/VerifyEmailPage/AccountRecoveryPage.tsx
index 5e7bd9e944..4776bbbb5b 100644
--- a/frontend/src/pages/auth/VerifyEmailPage/VerifyEmailPage.tsx
+++ b/frontend/src/pages/auth/VerifyEmailPage/AccountRecoveryPage.tsx
@@ -4,22 +4,22 @@ import { Link } from "@tanstack/react-router";
import { Button, EmailServiceSetupModal, Input } from "@app/components/v2";
import { usePopUp } from "@app/hooks";
-import { useSendPasswordResetEmail } from "@app/hooks/api";
+import { useSendAccountRecoveryEmail } from "@app/hooks/api/account-recovery";
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
-export const VerifyEmailPage = () => {
+export const AccountRecoveryPage = () => {
const [loading, setLoading] = useState(false);
const [email, setEmail] = useState("");
const [step, setStep] = useState(1);
const { data: serverDetails } = useFetchServerStatus();
const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp(["setUpEmail"] as const);
- const { mutateAsync } = useSendPasswordResetEmail();
+ const { mutateAsync } = useSendAccountRecoveryEmail();
/**
- * This function sends the verification email and forwards a user to the next step.
+ * This function sends the recovery email and forwards a user to the next step.
*/
- const sendVerificationEmail = async () => {
+ const sendRecoveryEmail = async () => {
if (email) {
try {
await mutateAsync({ email });
@@ -35,7 +35,7 @@ export const VerifyEmailPage = () => {
setLoading(true);
if (serverDetails?.emailConfigured) {
- sendVerificationEmail();
+ sendRecoveryEmail();
} else {
handlePopUpOpen("setUpEmail");
setLoading(false);
@@ -45,10 +45,10 @@ export const VerifyEmailPage = () => {
return (
<div className="flex min-h-screen flex-col justify-center bg-linear-to-tr from-mineshaft-600 via-mineshaft-800 to-bunker-700 px-6 pb-28">
<Helmet>
- <title>Reset Password</title>
+ <title>Account Recovery</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
- <meta property="og:title" content="Verify your email in Infisical" />
+ <meta property="og:title" content="Account Recovery in Infisical" />
<meta
name="og:description"
content="Infisical a simple end-to-end encrypted platform that enables teams to sync and manage their .env files."
diff --git a/frontend/src/pages/auth/VerifyEmailPage/route.tsx b/frontend/src/pages/auth/VerifyEmailPage/route.tsx
index b5150364c4..7ed66f4c40 100644
--- a/frontend/src/pages/auth/VerifyEmailPage/route.tsx
+++ b/frontend/src/pages/auth/VerifyEmailPage/route.tsx
@@ -1,7 +1,7 @@
import { createFileRoute } from "@tanstack/react-router";
-import { VerifyEmailPage } from "./VerifyEmailPage";
+import { AccountRecoveryPage } from "./AccountRecoveryPage";
export const Route = createFileRoute("/_restrict-login-signup/verify-email")({
- component: VerifyEmailPage
+ component: AccountRecoveryPage
});