Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

recover

Manav Rathi14cf59c1e559
diff --git a/web/packages/accounts/pages/login.tsx b/web/packages/accounts/pages/login.tsx
index 87976641bb..103f8ab14b 100644
--- a/web/packages/accounts/pages/login.tsx
+++ b/web/packages/accounts/pages/login.tsx
@@ -1,4 +1,5 @@
import log from "@/next/log";
+import { appNameToAppNameOld } from "@ente/shared/apps/constants";
import type { PageProps } from "@ente/shared/apps/types";
import { VerticallyCentered } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
@@ -18,7 +19,6 @@ import React, { useEffect, useState } from "react";
import { getSRPAttributes } from "../api/srp";
import { sendOtt } from "../api/user";
import { PAGES } from "../constants/pages";
-import { appNameToAppNameOld } from "@ente/shared/apps/constants";
const Page: React.FC<PageProps> = ({ appContext }) => {
const { appName, showNavBar } = appContext;
diff --git a/web/packages/accounts/pages/recover.tsx b/web/packages/accounts/pages/recover.tsx
index 09e0004875..d56d0c8804 100644
--- a/web/packages/accounts/pages/recover.tsx
+++ b/web/packages/accounts/pages/recover.tsx
@@ -2,7 +2,7 @@ import log from "@/next/log";
import { ensure } from "@/utils/ensure";
import { sendOtt } from "@ente/accounts/api/user";
import { PAGES } from "@ente/accounts/constants/pages";
-import { APP_HOMES } from "@ente/shared/apps/constants";
+import { APP_HOMES, appNameToAppNameOld } from "@ente/shared/apps/constants";
import type { PageProps } from "@ente/shared/apps/types";
import { VerticallyCentered } from "@ente/shared/components/Container";
import FormPaper from "@ente/shared/components/Form/FormPaper";
@@ -29,13 +29,16 @@ const bip39 = require("bip39");
// mobile client library only supports english.
bip39.setDefaultWordlist("english");
-export default function Recover({ appContext, appName }: PageProps) {
+const Page: React.FC<PageProps> = ({ appContext }) => {
const [keyAttributes, setKeyAttributes] = useState<
KeyAttributes | undefined
>();
const router = useRouter();
+ const appNameOld = appNameToAppNameOld(appContext.appName);
+
+
useEffect(() => {
const user: User = getData(LS_KEYS.USER);
const keyAttributes: KeyAttributes = getData(LS_KEYS.KEY_ATTRIBUTES);
@@ -45,7 +48,7 @@ export default function Recover({ appContext, appName }: PageProps) {
return;
}
if (!user?.encryptedToken && !user?.token) {
- sendOtt(appName, user.email);
+ sendOtt(appNameOld, user.email);
InMemoryStore.set(MS_KEYS.REDIRECT_URL, PAGES.RECOVER);
router.push(PAGES.VERIFY);
return;
@@ -54,7 +57,7 @@ export default function Recover({ appContext, appName }: PageProps) {
router.push(PAGES.GENERATE);
} else if (key) {
// TODO: Refactor the type of APP_HOMES to not require the ??
- router.push(APP_HOMES.get(appName) ?? "/");
+ router.push(APP_HOMES.get(appNameOld) ?? "/");
} else {
setKeyAttributes(keyAttributes);
}
@@ -127,4 +130,6 @@ export default function Recover({ appContext, appName }: PageProps) {
</FormPaper>
</VerticallyCentered>
);
-}
+};
+
+export default Page;