Skip to content

armgit / ente

Public Imported from GitHub
0

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

Freshness check

Manav Rathi1eb5eaece95a
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index f56aa57d49..924d210b08 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -33,6 +33,7 @@ import { t } from "i18next";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { Trans } from "react-i18next";
+import { getSRPAttributes } from "../api/srp";
import { putAttributes, sendOtt, verifyOtt } from "../api/user";
import { PAGES } from "../constants/pages";
import {
@@ -85,7 +86,18 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
LS_KEYS.SRP_ATTRIBUTES,
);
if (srpAttributes && !srpAttributes.isEmailMFAEnabled) {
- router.push(PAGES.CREDENTIALS);
+ // Fetch the latest SRP attributes instead of relying on the
+ // potentially stale stored values. This is an infrequent scenario
+ // path, so extra API calls are fine.
+ const latestSRPAttributes = await getSRPAttributes(email);
+ if (
+ latestSRPAttributes &&
+ !latestSRPAttributes.isEmailMFAEnabled
+ ) {
+ router.push(PAGES.CREDENTIALS);
+ } else {
+ setEmail(user.email);
+ }
} else {
setEmail(user.email);
}