From 171f3c5d71c631ed9041a706d4b9af73ebe2d649 Mon Sep 17 00:00:00 2001 From: shuaiplus <2327005759@qq.com> Date: Sun, 15 Mar 2026 18:26:36 +0800 Subject: [PATCH] feat: refactor authentication forms to use
elements for better submission handling --- webapp/src/components/AuthViews.tsx | 195 ++++++++++-------- webapp/src/components/ConfirmDialog.tsx | 13 +- webapp/src/components/PublicSendPage.tsx | 11 +- .../src/components/RecoverTwoFactorPage.tsx | 87 ++++---- 4 files changed, 172 insertions(+), 134 deletions(-) diff --git a/webapp/src/components/AuthViews.tsx b/webapp/src/components/AuthViews.tsx index 61259ea..40e6787 100644 --- a/webapp/src/components/AuthViews.tsx +++ b/webapp/src/components/AuthViews.tsx @@ -64,22 +64,29 @@ export default function AuthViews(props: AuthViewsProps) { return (
-

{props.emailForLock}

- - -
{t('txt_or')}
- + { + e.preventDefault(); + props.onSubmitUnlock(); + }} + > +

{props.emailForLock}

+ + +
{t('txt_or')}
+ +
); @@ -89,56 +96,63 @@ export default function AuthViews(props: AuthViewsProps) { return (
-
); @@ -147,30 +161,37 @@ export default function AuthViews(props: AuthViewsProps) { return (
-
); diff --git a/webapp/src/components/ConfirmDialog.tsx b/webapp/src/components/ConfirmDialog.tsx index 8743570..81b8f0b 100644 --- a/webapp/src/components/ConfirmDialog.tsx +++ b/webapp/src/components/ConfirmDialog.tsx @@ -20,14 +20,19 @@ export default function ConfirmDialog(props: ConfirmDialogProps) { if (!props.open) return null; return (
-
+
{ + e.preventDefault(); + props.onConfirm(); + }} + >

{props.title}

{props.message}
{props.children} {props.afterActions} -
+
); } diff --git a/webapp/src/components/PublicSendPage.tsx b/webapp/src/components/PublicSendPage.tsx index b769be4..23dc459 100644 --- a/webapp/src/components/PublicSendPage.tsx +++ b/webapp/src/components/PublicSendPage.tsx @@ -92,7 +92,12 @@ export default function PublicSendPage(props: PublicSendPageProps) { {loading &&

{t('txt_loading')}

} {!loading && needPassword && ( - <> +
{ + e.preventDefault(); + void loadSend(password); + }} + > - - +
)} {!loading && sendData && ( diff --git a/webapp/src/components/RecoverTwoFactorPage.tsx b/webapp/src/components/RecoverTwoFactorPage.tsx index e91c79d..b76e7ff 100644 --- a/webapp/src/components/RecoverTwoFactorPage.tsx +++ b/webapp/src/components/RecoverTwoFactorPage.tsx @@ -16,52 +16,59 @@ export default function RecoverTwoFactorPage(props: RecoverTwoFactorPageProps) { return (
-

{t('txt_use_your_one_time_recovery_code_to_disable_two_step_verification')}

+
{ + e.preventDefault(); + props.onSubmit(); + }} + > +

{t('txt_use_your_one_time_recovery_code_to_disable_two_step_verification')}

- - - + + + +
+ +
- - - - -
- - -
+
);