Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor(auth):consolidate-verification-and-recovery-pages

Aswin Asoka8402b0d8a9e
diff --git a/web/apps/auth/src/pages/change-password.tsx b/web/apps/auth/src/pages/change-password.tsx
index 630460b002..0e494377ee 100644
--- a/web/apps/auth/src/pages/change-password.tsx
+++ b/web/apps/auth/src/pages/change-password.tsx
@@ -1,17 +1 @@
-import { AuthShell } from "@/components/AuthShell";
-import { SetPasswordForm } from "ente-accounts/components/auth/SetPasswordForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsChangePasswordPage from "ente-accounts/pages/change-password";
-import type React from "react";
-
-const ResetPasswordPresentation = withAuthPageShell(SetPasswordForm, AuthShell);
-
-function ChangePasswordPage(): React.JSX.Element {
- return (
- <AccountsChangePasswordPage
- resetPresentation={ResetPasswordPresentation}
- />
- );
-}
-
-export default ChangePasswordPage;
+export { default } from "ente-accounts/pages/change-password";
diff --git a/web/apps/auth/src/pages/credentials.tsx b/web/apps/auth/src/pages/credentials.tsx
index 2d85b926a1..9b8df2e13d 100644
--- a/web/apps/auth/src/pages/credentials.tsx
+++ b/web/apps/auth/src/pages/credentials.tsx
@@ -1,23 +1 @@
-import { AuthShell } from "@/components/AuthShell";
-import {
- CredentialsForm,
- PasswordForm,
-} from "ente-accounts/components/auth/CredentialsForm";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsCredentialsPage from "ente-accounts/pages/credentials";
-import type React from "react";
-
-const CredentialsPresentation = withAuthPageShell(CredentialsForm, AuthShell);
-
-function CredentialsPage(): React.JSX.Element {
- return (
- <AccountsCredentialsPage
- presentation={CredentialsPresentation}
- passwordPresentation={PasswordForm}
- secondFactorChoicePresentation={SecondFactorChoiceDialog}
- />
- );
-}
-
-export default CredentialsPage;
+export { default } from "ente-accounts/pages/credentials";
diff --git a/web/apps/auth/src/pages/passkeys/recover.tsx b/web/apps/auth/src/pages/passkeys/recover.tsx
index 4b7e7be268..42f58372cc 100644
--- a/web/apps/auth/src/pages/passkeys/recover.tsx
+++ b/web/apps/auth/src/pages/passkeys/recover.tsx
@@ -1,22 +1 @@
-import { AuthShell } from "@/components/AuthShell";
-import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorRecoverPage from "ente-accounts/pages/two-factor/recover";
-import type React from "react";
-
-const RecoverTwoFactorPresentation = withAuthPageShell(
- RecoverTwoFactorForm,
- AuthShell,
- 420,
-);
-
-function PasskeyRecoverPage(): React.JSX.Element {
- return (
- <AccountsTwoFactorRecoverPage
- twoFactorType="passkey"
- presentation={RecoverTwoFactorPresentation}
- />
- );
-}
-
-export default PasskeyRecoverPage;
+export { default } from "ente-accounts/pages/passkeys/recover";
diff --git a/web/apps/auth/src/pages/recover.tsx b/web/apps/auth/src/pages/recover.tsx
index f18e853619..eb6a74c593 100644
--- a/web/apps/auth/src/pages/recover.tsx
+++ b/web/apps/auth/src/pages/recover.tsx
@@ -1,17 +1 @@
-import { AuthShell } from "@/components/AuthShell";
-import { RecoverAccountForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsRecoverPage from "ente-accounts/pages/recover";
-import type React from "react";
-
-const RecoverAccountPresentation = withAuthPageShell(
- RecoverAccountForm,
- AuthShell,
- 420,
-);
-
-function RecoverPage(): React.JSX.Element {
- return <AccountsRecoverPage presentation={RecoverAccountPresentation} />;
-}
-
-export default RecoverPage;
+export { default } from "ente-accounts/pages/recover";
diff --git a/web/apps/auth/src/pages/two-factor/recover.tsx b/web/apps/auth/src/pages/two-factor/recover.tsx
index 626f82e30e..ea958cc9bf 100644
--- a/web/apps/auth/src/pages/two-factor/recover.tsx
+++ b/web/apps/auth/src/pages/two-factor/recover.tsx
@@ -1,22 +1 @@
-import { AuthShell } from "@/components/AuthShell";
-import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorRecoverPage from "ente-accounts/pages/two-factor/recover";
-import type React from "react";
-
-const RecoverTwoFactorPresentation = withAuthPageShell(
- RecoverTwoFactorForm,
- AuthShell,
- 420,
-);
-
-function TwoFactorRecoverPage(): React.JSX.Element {
- return (
- <AccountsTwoFactorRecoverPage
- twoFactorType="totp"
- presentation={RecoverTwoFactorPresentation}
- />
- );
-}
-
-export default TwoFactorRecoverPage;
+export { default } from "ente-accounts/pages/two-factor/recover";
diff --git a/web/apps/auth/src/pages/two-factor/verify.tsx b/web/apps/auth/src/pages/two-factor/verify.tsx
index 7c01d58549..f3f3c99656 100644
--- a/web/apps/auth/src/pages/two-factor/verify.tsx
+++ b/web/apps/auth/src/pages/two-factor/verify.tsx
@@ -1,13 +1 @@
-import { AuthShell } from "@/components/AuthShell";
-import { TwoFactorForm } from "ente-accounts/components/auth/TwoFactorForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorVerifyPage from "ente-accounts/pages/two-factor/verify";
-import type React from "react";
-
-const TwoFactorPresentation = withAuthPageShell(TwoFactorForm, AuthShell);
-
-function TwoFactorVerifyPage(): React.JSX.Element {
- return <AccountsTwoFactorVerifyPage presentation={TwoFactorPresentation} />;
-}
-
-export default TwoFactorVerifyPage;
+export { default } from "ente-accounts/pages/two-factor/verify";
diff --git a/web/apps/auth/src/pages/verify.tsx b/web/apps/auth/src/pages/verify.tsx
index 71056cfed0..7ec623fac9 100644
--- a/web/apps/auth/src/pages/verify.tsx
+++ b/web/apps/auth/src/pages/verify.tsx
@@ -1,19 +1 @@
-import { AuthShell } from "@/components/AuthShell";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
-import { VerifyEmailForm } from "ente-accounts/components/auth/VerifyEmailForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsVerifyPage from "ente-accounts/pages/verify";
-import type React from "react";
-
-const VerifyEmailPresentation = withAuthPageShell(VerifyEmailForm, AuthShell);
-
-function VerifyPage(): React.JSX.Element {
- return (
- <AccountsVerifyPage
- presentation={VerifyEmailPresentation}
- secondFactorChoicePresentation={SecondFactorChoiceDialog}
- />
- );
-}
-
-export default VerifyPage;
+export { default } from "ente-accounts/pages/verify";
diff --git a/web/apps/locker/src/pages/change-password.tsx b/web/apps/locker/src/pages/change-password.tsx
index 0f4c3b89d9..0e494377ee 100644
--- a/web/apps/locker/src/pages/change-password.tsx
+++ b/web/apps/locker/src/pages/change-password.tsx
@@ -1,20 +1 @@
-import { LockerAuthShell } from "@/components/auth/LockerAuthShell";
-import { SetPasswordForm } from "ente-accounts/components/auth/SetPasswordForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsChangePasswordPage from "ente-accounts/pages/change-password";
-import type React from "react";
-
-const ResetPasswordPresentation = withAuthPageShell(
- SetPasswordForm,
- LockerAuthShell,
-);
-
-function ChangePasswordPage(): React.JSX.Element {
- return (
- <AccountsChangePasswordPage
- resetPresentation={ResetPasswordPresentation}
- />
- );
-}
-
-export default ChangePasswordPage;
+export { default } from "ente-accounts/pages/change-password";
diff --git a/web/apps/locker/src/pages/credentials.tsx b/web/apps/locker/src/pages/credentials.tsx
index 7a283168f6..9b8df2e13d 100644
--- a/web/apps/locker/src/pages/credentials.tsx
+++ b/web/apps/locker/src/pages/credentials.tsx
@@ -1,26 +1 @@
-import { LockerAuthShell } from "@/components/auth/LockerAuthShell";
-import {
- CredentialsForm,
- PasswordForm,
-} from "ente-accounts/components/auth/CredentialsForm";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsCredentialsPage from "ente-accounts/pages/credentials";
-import type React from "react";
-
-const CredentialsPresentation = withAuthPageShell(
- CredentialsForm,
- LockerAuthShell,
-);
-
-function CredentialsPage(): React.JSX.Element {
- return (
- <AccountsCredentialsPage
- presentation={CredentialsPresentation}
- passwordPresentation={PasswordForm}
- secondFactorChoicePresentation={SecondFactorChoiceDialog}
- />
- );
-}
-
-export default CredentialsPage;
+export { default } from "ente-accounts/pages/credentials";
diff --git a/web/apps/locker/src/pages/passkeys/recover.tsx b/web/apps/locker/src/pages/passkeys/recover.tsx
index 1416eb05af..42f58372cc 100644
--- a/web/apps/locker/src/pages/passkeys/recover.tsx
+++ b/web/apps/locker/src/pages/passkeys/recover.tsx
@@ -1,22 +1 @@
-import { LockerAuthShell } from "@/components/auth/LockerAuthShell";
-import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorRecoverPage from "ente-accounts/pages/two-factor/recover";
-import type React from "react";
-
-const RecoverTwoFactorPresentation = withAuthPageShell(
- RecoverTwoFactorForm,
- LockerAuthShell,
- 420,
-);
-
-function PasskeyRecoverPage(): React.JSX.Element {
- return (
- <AccountsTwoFactorRecoverPage
- twoFactorType="passkey"
- presentation={RecoverTwoFactorPresentation}
- />
- );
-}
-
-export default PasskeyRecoverPage;
+export { default } from "ente-accounts/pages/passkeys/recover";
diff --git a/web/apps/locker/src/pages/recover.tsx b/web/apps/locker/src/pages/recover.tsx
index 28b3dd5c4b..eb6a74c593 100644
--- a/web/apps/locker/src/pages/recover.tsx
+++ b/web/apps/locker/src/pages/recover.tsx
@@ -1,17 +1 @@
-import { LockerAuthShell } from "@/components/auth/LockerAuthShell";
-import { RecoverAccountForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsRecoverPage from "ente-accounts/pages/recover";
-import type React from "react";
-
-const RecoverAccountPresentation = withAuthPageShell(
- RecoverAccountForm,
- LockerAuthShell,
- 420,
-);
-
-function RecoverPage(): React.JSX.Element {
- return <AccountsRecoverPage presentation={RecoverAccountPresentation} />;
-}
-
-export default RecoverPage;
+export { default } from "ente-accounts/pages/recover";
diff --git a/web/apps/locker/src/pages/two-factor/recover.tsx b/web/apps/locker/src/pages/two-factor/recover.tsx
index 7edba4afc5..ea958cc9bf 100644
--- a/web/apps/locker/src/pages/two-factor/recover.tsx
+++ b/web/apps/locker/src/pages/two-factor/recover.tsx
@@ -1,22 +1 @@
-import { LockerAuthShell } from "@/components/auth/LockerAuthShell";
-import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorRecoverPage from "ente-accounts/pages/two-factor/recover";
-import type React from "react";
-
-const RecoverTwoFactorPresentation = withAuthPageShell(
- RecoverTwoFactorForm,
- LockerAuthShell,
- 420,
-);
-
-function TwoFactorRecoverPage(): React.JSX.Element {
- return (
- <AccountsTwoFactorRecoverPage
- twoFactorType="totp"
- presentation={RecoverTwoFactorPresentation}
- />
- );
-}
-
-export default TwoFactorRecoverPage;
+export { default } from "ente-accounts/pages/two-factor/recover";
diff --git a/web/apps/locker/src/pages/two-factor/verify.tsx b/web/apps/locker/src/pages/two-factor/verify.tsx
index 249efdf1f1..f3f3c99656 100644
--- a/web/apps/locker/src/pages/two-factor/verify.tsx
+++ b/web/apps/locker/src/pages/two-factor/verify.tsx
@@ -1,13 +1 @@
-import { LockerAuthShell } from "@/components/auth/LockerAuthShell";
-import { TwoFactorForm } from "ente-accounts/components/auth/TwoFactorForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorVerifyPage from "ente-accounts/pages/two-factor/verify";
-import type React from "react";
-
-const TwoFactorPresentation = withAuthPageShell(TwoFactorForm, LockerAuthShell);
-
-function TwoFactorVerifyPage(): React.JSX.Element {
- return <AccountsTwoFactorVerifyPage presentation={TwoFactorPresentation} />;
-}
-
-export default TwoFactorVerifyPage;
+export { default } from "ente-accounts/pages/two-factor/verify";
diff --git a/web/apps/locker/src/pages/verify.tsx b/web/apps/locker/src/pages/verify.tsx
index ed7da3d0d2..7ec623fac9 100644
--- a/web/apps/locker/src/pages/verify.tsx
+++ b/web/apps/locker/src/pages/verify.tsx
@@ -1,22 +1 @@
-import { LockerAuthShell } from "@/components/auth/LockerAuthShell";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
-import { VerifyEmailForm } from "ente-accounts/components/auth/VerifyEmailForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsVerifyPage from "ente-accounts/pages/verify";
-import type React from "react";
-
-const VerifyEmailPresentation = withAuthPageShell(
- VerifyEmailForm,
- LockerAuthShell,
-);
-
-function VerifyPage(): React.JSX.Element {
- return (
- <AccountsVerifyPage
- presentation={VerifyEmailPresentation}
- secondFactorChoicePresentation={SecondFactorChoiceDialog}
- />
- );
-}
-
-export default VerifyPage;
+export { default } from "ente-accounts/pages/verify";
diff --git a/web/apps/photos/src/auth-page-config.ts b/web/apps/photos/src/auth-page-config.ts
index ac685ccf6b..3113570342 100644
--- a/web/apps/photos/src/auth-page-config.ts
+++ b/web/apps/photos/src/auth-page-config.ts
@@ -1,4 +1,12 @@
+import { PasskeyVerificationForm } from "@/components/auth/PasskeyVerificationForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import type { AuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
+import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-export const authPageConfig: AuthPageConfig = { Shell: PhotosAuthShell };
+export const authPageConfig: AuthPageConfig = {
+ Shell: PhotosAuthShell,
+ passkeyPresentation: withAuthPageShell(
+ PasskeyVerificationForm,
+ PhotosAuthShell,
+ ),
+};
diff --git a/web/apps/photos/src/pages/change-password.tsx b/web/apps/photos/src/pages/change-password.tsx
index 2d92a7b29a..0e494377ee 100644
--- a/web/apps/photos/src/pages/change-password.tsx
+++ b/web/apps/photos/src/pages/change-password.tsx
@@ -1,20 +1 @@
-import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import { SetPasswordForm } from "ente-accounts/components/auth/SetPasswordForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsChangePasswordPage from "ente-accounts/pages/change-password";
-import type React from "react";
-
-const ResetPasswordPresentation = withAuthPageShell(
- SetPasswordForm,
- PhotosAuthShell,
-);
-
-function ChangePasswordPage(): React.JSX.Element {
- return (
- <AccountsChangePasswordPage
- resetPresentation={ResetPasswordPresentation}
- />
- );
-}
-
-export default ChangePasswordPage;
+export { default } from "ente-accounts/pages/change-password";
diff --git a/web/apps/photos/src/pages/credentials.tsx b/web/apps/photos/src/pages/credentials.tsx
index 2fa76df413..9b8df2e13d 100644
--- a/web/apps/photos/src/pages/credentials.tsx
+++ b/web/apps/photos/src/pages/credentials.tsx
@@ -1,33 +1 @@
-import { PasskeyVerificationForm } from "@/components/auth/PasskeyVerificationForm";
-import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import {
- CredentialsForm,
- PasswordForm,
-} from "ente-accounts/components/auth/CredentialsForm";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsCredentialsPage from "ente-accounts/pages/credentials";
-import type React from "react";
-
-const CredentialsPresentation = withAuthPageShell(
- CredentialsForm,
- PhotosAuthShell,
-);
-
-const PasskeyPresentation = withAuthPageShell(
- PasskeyVerificationForm,
- PhotosAuthShell,
-);
-
-function CredentialsPage(): React.JSX.Element {
- return (
- <AccountsCredentialsPage
- presentation={CredentialsPresentation}
- passwordPresentation={PasswordForm}
- passkeyPresentation={PasskeyPresentation}
- secondFactorChoicePresentation={SecondFactorChoiceDialog}
- />
- );
-}
-
-export default CredentialsPage;
+export { default } from "ente-accounts/pages/credentials";
diff --git a/web/apps/photos/src/pages/passkeys/recover.tsx b/web/apps/photos/src/pages/passkeys/recover.tsx
index eac04f0531..42f58372cc 100644
--- a/web/apps/photos/src/pages/passkeys/recover.tsx
+++ b/web/apps/photos/src/pages/passkeys/recover.tsx
@@ -1,22 +1 @@
-import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorRecoverPage from "ente-accounts/pages/two-factor/recover";
-import type React from "react";
-
-const RecoverTwoFactorPresentation = withAuthPageShell(
- RecoverTwoFactorForm,
- PhotosAuthShell,
- 420,
-);
-
-function PasskeyRecoverPage(): React.JSX.Element {
- return (
- <AccountsTwoFactorRecoverPage
- twoFactorType="passkey"
- presentation={RecoverTwoFactorPresentation}
- />
- );
-}
-
-export default PasskeyRecoverPage;
+export { default } from "ente-accounts/pages/passkeys/recover";
diff --git a/web/apps/photos/src/pages/recover.tsx b/web/apps/photos/src/pages/recover.tsx
index 40e94d2f5f..eb6a74c593 100644
--- a/web/apps/photos/src/pages/recover.tsx
+++ b/web/apps/photos/src/pages/recover.tsx
@@ -1,17 +1 @@
-import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import { RecoverAccountForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsRecoverPage from "ente-accounts/pages/recover";
-import type React from "react";
-
-const RecoverAccountPresentation = withAuthPageShell(
- RecoverAccountForm,
- PhotosAuthShell,
- 420,
-);
-
-function RecoverPage(): React.JSX.Element {
- return <AccountsRecoverPage presentation={RecoverAccountPresentation} />;
-}
-
-export default RecoverPage;
+export { default } from "ente-accounts/pages/recover";
diff --git a/web/apps/photos/src/pages/two-factor/recover.tsx b/web/apps/photos/src/pages/two-factor/recover.tsx
index 4658481820..ea958cc9bf 100644
--- a/web/apps/photos/src/pages/two-factor/recover.tsx
+++ b/web/apps/photos/src/pages/two-factor/recover.tsx
@@ -1,22 +1 @@
-import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorRecoverPage from "ente-accounts/pages/two-factor/recover";
-import type React from "react";
-
-const RecoverTwoFactorPresentation = withAuthPageShell(
- RecoverTwoFactorForm,
- PhotosAuthShell,
- 420,
-);
-
-function TwoFactorRecoverPage(): React.JSX.Element {
- return (
- <AccountsTwoFactorRecoverPage
- twoFactorType="totp"
- presentation={RecoverTwoFactorPresentation}
- />
- );
-}
-
-export default TwoFactorRecoverPage;
+export { default } from "ente-accounts/pages/two-factor/recover";
diff --git a/web/apps/photos/src/pages/two-factor/verify.tsx b/web/apps/photos/src/pages/two-factor/verify.tsx
index 2502a44576..f3f3c99656 100644
--- a/web/apps/photos/src/pages/two-factor/verify.tsx
+++ b/web/apps/photos/src/pages/two-factor/verify.tsx
@@ -1,13 +1 @@
-import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import { TwoFactorForm } from "ente-accounts/components/auth/TwoFactorForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsTwoFactorVerifyPage from "ente-accounts/pages/two-factor/verify";
-import type React from "react";
-
-const TwoFactorPresentation = withAuthPageShell(TwoFactorForm, PhotosAuthShell);
-
-function TwoFactorVerifyPage(): React.JSX.Element {
- return <AccountsTwoFactorVerifyPage presentation={TwoFactorPresentation} />;
-}
-
-export default TwoFactorVerifyPage;
+export { default } from "ente-accounts/pages/two-factor/verify";
diff --git a/web/apps/photos/src/pages/verify.tsx b/web/apps/photos/src/pages/verify.tsx
index e3e6edd9c4..7ec623fac9 100644
--- a/web/apps/photos/src/pages/verify.tsx
+++ b/web/apps/photos/src/pages/verify.tsx
@@ -1,29 +1 @@
-import { PasskeyVerificationForm } from "@/components/auth/PasskeyVerificationForm";
-import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
-import { VerifyEmailForm } from "ente-accounts/components/auth/VerifyEmailForm";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
-import AccountsVerifyPage from "ente-accounts/pages/verify";
-import type React from "react";
-
-const VerifyEmailPresentation = withAuthPageShell(
- VerifyEmailForm,
- PhotosAuthShell,
-);
-
-const PasskeyPresentation = withAuthPageShell(
- PasskeyVerificationForm,
- PhotosAuthShell,
-);
-
-function VerifyPage(): React.JSX.Element {
- return (
- <AccountsVerifyPage
- presentation={VerifyEmailPresentation}
- passkeyPresentation={PasskeyPresentation}
- secondFactorChoicePresentation={SecondFactorChoiceDialog}
- />
- );
-}
-
-export default VerifyPage;
+export { default } from "ente-accounts/pages/verify";
diff --git a/web/packages/accounts/components/auth/AuthPageProvider.ts b/web/packages/accounts/components/auth/AuthPageProvider.ts
index 0647c8a369..142f2ea45c 100644
--- a/web/packages/accounts/components/auth/AuthPageProvider.ts
+++ b/web/packages/accounts/components/auth/AuthPageProvider.ts
@@ -1,8 +1,10 @@
import { createContext, useContext, type ComponentType } from "react";
+import type { VerifyingPasskeyPresentationProps } from "../LoginComponents";
import type { AuthPageShellProps } from "./AuthPageShell";
/** App defaults for shared account pages, not reusable forms or dialogs. */
export interface AuthPageConfig {
+ passkeyPresentation?: ComponentType<VerifyingPasskeyPresentationProps>;
Shell?: ComponentType<
Pick<AuthPageShellProps, "children" | "contentWidth">
>;
diff --git a/web/packages/accounts/pages/change-password.tsx b/web/packages/accounts/pages/change-password.tsx
index a417dde623..f5862aac60 100644
--- a/web/packages/accounts/pages/change-password.tsx
+++ b/web/packages/accounts/pages/change-password.tsx
@@ -1,4 +1,6 @@
import { Divider } from "@mui/material";
+import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
+import { SetPasswordForm } from "ente-accounts/components/auth/SetPasswordForm";
import {
AccountsPageContents,
AccountsPageFooter,
@@ -29,7 +31,13 @@ export interface ChangePasswordPageProps {
resetPresentation?: ComponentType<NewPasswordPresentationProps>;
}
-const Page: React.FC<ChangePasswordPageProps> = ({ resetPresentation }) => {
+const Page: React.FC<ChangePasswordPageProps> = ({
+ resetPresentation: explicitResetPresentation,
+}) => {
+ const { Shell } = useAuthPageConfig();
+ const resetPresentation =
+ explicitResetPresentation ??
+ (Shell ? ConfiguredResetPasswordPresentation : undefined);
const [user, setUser] = useState<LocalUser | undefined>(undefined);
const router = useRouter();
@@ -115,3 +123,14 @@ const PageContents: React.FC<PageContentsProps> = ({
</AccountsPageContents>
);
};
+
+function ConfiguredResetPasswordPresentation(
+ props: NewPasswordPresentationProps,
+): React.JSX.Element {
+ const Shell = useAuthPageConfig().Shell!;
+ return (
+ <Shell>
+ <SetPasswordForm {...props} />
+ </Shell>
+ );
+}
diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx
index 70acc50a5c..3f86259576 100644
--- a/web/packages/accounts/pages/credentials.tsx
+++ b/web/packages/accounts/pages/credentials.tsx
@@ -1,3 +1,9 @@
+import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
+import {
+ CredentialsForm,
+ PasswordForm,
+} from "ente-accounts/components/auth/CredentialsForm";
+import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
import { AccountsPageContents } from "ente-accounts/components/layouts/centered-paper";
import {
AccountsPageFooterWithHost,
@@ -91,11 +97,23 @@ export interface CredentialsPageProps {
}
const Page: React.FC<CredentialsPageProps> = ({
- presentation: Presentation,
- passwordPresentation,
- passkeyPresentation,
- secondFactorChoicePresentation,
+ presentation: explicitPresentation,
+ passwordPresentation: explicitPasswordPresentation,
+ passkeyPresentation: explicitPasskeyPresentation,
+ secondFactorChoicePresentation: explicitSecondFactorChoicePresentation,
}) => {
+ const { Shell, passkeyPresentation: configuredPasskeyPresentation } =
+ useAuthPageConfig();
+ const Presentation =
+ explicitPresentation ??
+ (Shell ? ConfiguredCredentialsPresentation : undefined);
+ const passkeyPresentation =
+ explicitPasskeyPresentation ?? configuredPasskeyPresentation;
+ const secondFactorChoicePresentation =
+ explicitSecondFactorChoicePresentation ??
+ (Shell ? SecondFactorChoiceDialog : undefined);
+ const passwordPresentation =
+ explicitPasswordPresentation ?? (Shell ? PasswordForm : undefined);
const { logout, showMiniDialog } = useBaseContext();
const [userEmail, setUserEmail] = useState<string>("");
@@ -423,3 +441,14 @@ const Page: React.FC<CredentialsPageProps> = ({
};
export default Page;
+
+function ConfiguredCredentialsPresentation(
+ props: CredentialsPresentationProps,
+): React.JSX.Element {
+ const Shell = useAuthPageConfig().Shell!;
+ return (
+ <Shell>
+ <CredentialsForm {...props} />
+ </Shell>
+ );
+}
diff --git a/web/packages/accounts/pages/passkeys/recover.tsx b/web/packages/accounts/pages/passkeys/recover.tsx
new file mode 100644
index 0000000000..7bccdac368
--- /dev/null
+++ b/web/packages/accounts/pages/passkeys/recover.tsx
@@ -0,0 +1,9 @@
+import TwoFactorRecoverPage, {
+ type RecoverPageProps,
+} from "../two-factor/recover";
+
+export default function PasskeyRecoverPage(
+ props: Omit<RecoverPageProps, "twoFactorType">,
+): React.JSX.Element {
+ return <TwoFactorRecoverPage {...props} twoFactorType="passkey" />;
+}
diff --git a/web/packages/accounts/pages/recover.tsx b/web/packages/accounts/pages/recover.tsx
index 94c104359b..62d9fe5b6b 100644
--- a/web/packages/accounts/pages/recover.tsx
+++ b/web/packages/accounts/pages/recover.tsx
@@ -1,3 +1,5 @@
+import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
+import { RecoverAccountForm } from "ente-accounts/components/auth/RecoveryForm";
import {
AccountsPageContents,
AccountsPageFooter,
@@ -38,7 +40,11 @@ export interface RecoverPageProps {
presentation?: ComponentType<RecoverAccountPresentationProps>;
}
-const Page: React.FC<RecoverPageProps> = ({ presentation: Presentation }) => {
+const Page: React.FC<RecoverPageProps> = ({ presentation }) => {
+ const { Shell } = useAuthPageConfig();
+ const Presentation =
+ presentation ??
+ (Shell ? ConfiguredRecoverAccountPresentation : undefined);
const { showMiniDialog } = useBaseContext();
const [keyAttributes, setKeyAttributes] = useState<
@@ -136,3 +142,14 @@ const Page: React.FC<RecoverPageProps> = ({ presentation: Presentation }) => {
};
export default Page;
+
+function ConfiguredRecoverAccountPresentation(
+ props: RecoverAccountPresentationProps,
+): React.JSX.Element {
+ const Shell = useAuthPageConfig().Shell!;
+ return (
+ <Shell contentWidth={420}>
+ <RecoverAccountForm {...props} />
+ </Shell>
+ );
+}
diff --git a/web/packages/accounts/pages/two-factor/recover.tsx b/web/packages/accounts/pages/two-factor/recover.tsx
index d9b83837a8..433ffd7e6d 100644
--- a/web/packages/accounts/pages/two-factor/recover.tsx
+++ b/web/packages/accounts/pages/two-factor/recover.tsx
@@ -1,4 +1,6 @@
import { Link } from "@mui/material";
+import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
+import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
import {
AccountsPageContents,
AccountsPageFooter,
@@ -39,14 +41,18 @@ export interface TwoFactorRecoverPresentationProps {
}
export interface RecoverPageProps {
- twoFactorType: TwoFactorType;
+ twoFactorType?: TwoFactorType;
presentation?: ComponentType<TwoFactorRecoverPresentationProps>;
}
const Page: React.FC<RecoverPageProps> = ({
- twoFactorType,
- presentation: Presentation,
+ twoFactorType = "totp",
+ presentation,
}) => {
+ const { Shell } = useAuthPageConfig();
+ const Presentation =
+ presentation ??
+ (Shell ? ConfiguredRecoverTwoFactorPresentation : undefined);
const { logout, showMiniDialog, onGenericError } = useBaseContext();
const [sessionID, setSessionID] = useState<string | undefined>(undefined);
@@ -169,3 +175,14 @@ const Page: React.FC<RecoverPageProps> = ({
};
export default Page;
+
+function ConfiguredRecoverTwoFactorPresentation(
+ props: TwoFactorRecoverPresentationProps,
+): React.JSX.Element {
+ const Shell = useAuthPageConfig().Shell!;
+ return (
+ <Shell contentWidth={420}>
+ <RecoverTwoFactorForm {...props} />
+ </Shell>
+ );
+}
diff --git a/web/packages/accounts/pages/two-factor/verify.tsx b/web/packages/accounts/pages/two-factor/verify.tsx
index f43f70597f..fe7ce8c454 100644
--- a/web/packages/accounts/pages/two-factor/verify.tsx
+++ b/web/packages/accounts/pages/two-factor/verify.tsx
@@ -1,3 +1,5 @@
+import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
+import { TwoFactorForm } from "ente-accounts/components/auth/TwoFactorForm";
import { Verify2FACodeForm } from "ente-accounts/components/Verify2FACodeForm";
import {
savedPartialLocalUser,
@@ -31,9 +33,10 @@ export interface TwoFactorVerifyPageProps {
presentation?: ComponentType<TwoFactorVerifyPresentationProps>;
}
-const Page: React.FC<TwoFactorVerifyPageProps> = ({
- presentation: Presentation,
-}) => {
+const Page: React.FC<TwoFactorVerifyPageProps> = ({ presentation }) => {
+ const { Shell } = useAuthPageConfig();
+ const Presentation =
+ presentation ?? (Shell ? ConfiguredTwoFactorPresentation : undefined);
const { logout } = useBaseContext();
const [twoFactorSessionID, setTwoFactorSessionID] = useState("");
@@ -107,3 +110,14 @@ const Page: React.FC<TwoFactorVerifyPageProps> = ({
};
export default Page;
+
+function ConfiguredTwoFactorPresentation(
+ props: TwoFactorVerifyPresentationProps,
+): React.JSX.Element {
+ const Shell = useAuthPageConfig().Shell!;
+ return (
+ <Shell>
+ <TwoFactorForm {...props} />
+ </Shell>
+ );
+}
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index db81624b67..f36538c626 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -1,4 +1,7 @@
import { Box, Typography } from "@mui/material";
+import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
+import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
+import { VerifyEmailForm } from "ente-accounts/components/auth/VerifyEmailForm";
import {
AccountsPageContents,
AccountsPageFooter,
@@ -75,10 +78,20 @@ export interface VerifyPageProps {
}
const Page: React.FC<VerifyPageProps> = ({
- presentation: Presentation,
- passkeyPresentation,
- secondFactorChoicePresentation,
+ presentation: explicitPresentation,
+ passkeyPresentation: explicitPasskeyPresentation,
+ secondFactorChoicePresentation: explicitSecondFactorChoicePresentation,
}) => {
+ const { Shell, passkeyPresentation: configuredPasskeyPresentation } =
+ useAuthPageConfig();
+ const Presentation =
+ explicitPresentation ??
+ (Shell ? ConfiguredVerifyEmailPresentation : undefined);
+ const passkeyPresentation =
+ explicitPasskeyPresentation ?? configuredPasskeyPresentation;
+ const secondFactorChoicePresentation =
+ explicitSecondFactorChoicePresentation ??
+ (Shell ? SecondFactorChoiceDialog : undefined);
const { logout, showMiniDialog } = useBaseContext();
const [email, setEmail] = useState("");
@@ -310,3 +323,14 @@ const redirectionIfNeededOrEmail = async () => {
return { email };
};
+
+function ConfiguredVerifyEmailPresentation(
+ props: VerifyEmailPresentationProps,
+): React.JSX.Element {
+ const Shell = useAuthPageConfig().Shell!;
+ return (
+ <Shell>
+ <VerifyEmailForm {...props} />
+ </Shell>
+ );
+}