Skip to content

armgit / ente

Public Imported from GitHub
0

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

Also handle for auth

Manav Rathi08f84c9cf8f2
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 201a514a2e..635685b7e3 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -1,6 +1,5 @@
import { Login } from "@/accounts/components/Login";
import { SignUp } from "@/accounts/components/SignUp";
-import type { SRPAttributes } from "@/accounts/types/srp";
import log from "@/base/log";
import { albumsAppOrigin, customAPIHost } from "@/base/origins";
import { DevSettings } from "@/new/photos/components/DevSettings";
@@ -90,26 +89,7 @@ export default function LandingPage() {
if (key && token) {
await router.push(PAGES.GALLERY);
} else if (user?.email) {
- // The user had previously entered their email on the login screen
- // but closed the tab before proceeding (or opened a us in a new tab
- // at this point).
- //
- // In such cases, we'll have an email present.
- //
- // Where to go next depends on whether they have enabled email
- // verification or not.
- //
- // The login page would have fetched and saved SRP attributes, so we
- // can see if they are present and indicate the email verification
- // is not required. Otherwise, move to the verification page.
- const srpAttributes: SRPAttributes = getData(
- LS_KEYS.SRP_ATTRIBUTES,
- );
- if (srpAttributes && !srpAttributes.isEmailMFAEnabled) {
- await router.push(PAGES.CREDENTIALS);
- } else {
- await router.push(PAGES.VERIFY);
- }
+ await router.push(PAGES.VERIFY);
}
await initLocalForage();
setLoading(false);
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index 1fd0d094e1..f56aa57d49 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -42,7 +42,7 @@ import {
import { unstashRedirect } from "../services/redirect";
import { configureSRP } from "../services/srp";
import type { PageProps } from "../types/page";
-import type { SRPSetupAttributes } from "../types/srp";
+import type { SRPAttributes, SRPSetupAttributes } from "../types/srp";
const Page: React.FC<PageProps> = ({ appContext }) => {
const { logout, showNavBar, setDialogBoxAttributesV2 } = appContext;
@@ -69,7 +69,26 @@ const Page: React.FC<PageProps> = ({ appContext }) => {
) {
router.push(PAGES.CREDENTIALS);
} else {
- setEmail(user.email);
+ // 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).
+ //
+ // In such cases, we'll end up here with an email present.
+ //
+ // To distinguish this scenario from the normal email
+ // verification flow, we can check to see the SRP attributes
+ // (the login page would've fetched and saved them). If they are
+ // present and indicate that email verification is not required,
+ // redirect to the password verification page.
+ const srpAttributes: SRPAttributes = getData(
+ LS_KEYS.SRP_ATTRIBUTES,
+ );
+ if (srpAttributes && !srpAttributes.isEmailMFAEnabled) {
+ router.push(PAGES.CREDENTIALS);
+ } else {
+ setEmail(user.email);
+ }
}
};
main();