π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web] Fix recover redirect
Manav Rathi10f4fd11186e
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsxindex 98a54adf8e..d6b0d574c1 100644--- a/web/packages/accounts/pages/verify.tsx+++ b/web/packages/accounts/pages/verify.tsx@@ -16,8 +16,8 @@ import SingleInputForm, {import { ApiError } from "@ente/shared/error";import localForage from "@ente/shared/storage/localForage";import {- LS_KEYS,getData,+ LS_KEYS,setData,setLSUser,} from "@ente/shared/storage/localStorage";@@ -40,7 +40,7 @@ import {openPasskeyVerificationURL,passkeyVerificationRedirectURL,} from "../services/passkey";-import { unstashRedirect } from "../services/redirect";+import { stashedRedirect, unstashRedirect } from "../services/redirect";import { configureSRP } from "../services/srp";import type { PageProps } from "../types/page";import type { SRPAttributes, SRPSetupAttributes } from "../types/srp";@@ -59,6 +59,7 @@ const Page: React.FC<PageProps> = ({ appContext }) => {useEffect(() => {const main = async () => {const user: User = getData(LS_KEYS.USER);+const redirect = await redirectionIfNeeded(user);if (redirect) {router.push(redirect);@@ -265,6 +266,9 @@ const redirectionIfNeeded = async (user: User | undefined) => {return PAGES.CREDENTIALS;}+ // If we're coming here during the recover flow, do not redirect.+ if (stashedRedirect() == PAGES.RECOVER) return undefined;+// The user might have email verification disabled, but after previously// entering their email on the login screen, they might've closed the tab// before proceeding (or opened a us in a new tab at this point).diff --git a/web/packages/accounts/services/redirect.ts b/web/packages/accounts/services/redirect.tsindex 8d102c94a5..d270e03a64 100644--- a/web/packages/accounts/services/redirect.ts+++ b/web/packages/accounts/services/redirect.ts@@ -17,6 +17,7 @@ let _stashedRedirect: string | undefined;/*** An in-memory redirect saved during the login flow (mostly).*/+export const stashedRedirect = () => _stashedRedirect;export const stashRedirect = (r: string) => (_stashedRedirect = r);export const unstashRedirect = () => {const r = _stashedRedirect;