Also handle for auth
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user