From 59b6c934c54ed5995061a41b2edaa635d465f49a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 21 Feb 2024 14:28:44 -0300 Subject: fix #8453 --- .../demobank-ui/src/pages/SolveChallengePage.tsx | 88 ++++++++++------------ .../src/pages/account/UpdateAccountPassword.tsx | 67 ++++++++-------- .../demobank-ui/src/pages/admin/AccountForm.tsx | 44 +++++------ .../demobank-ui/src/pages/admin/AccountList.tsx | 2 +- .../src/pages/admin/CreateNewAccount.tsx | 4 +- 5 files changed, 101 insertions(+), 104 deletions(-) (limited to 'packages/demobank-ui/src') diff --git a/packages/demobank-ui/src/pages/SolveChallengePage.tsx b/packages/demobank-ui/src/pages/SolveChallengePage.tsx index c7cd7e660..5ac622795 100644 --- a/packages/demobank-ui/src/pages/SolveChallengePage.tsx +++ b/packages/demobank-ui/src/pages/SolveChallengePage.tsx @@ -35,7 +35,7 @@ import { } from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; import { Fragment, VNode, h } from "preact"; -import { useState } from "preact/hooks"; +import { useEffect, useState } from "preact/hooks"; import { ErrorLoadingWithDebug } from "../components/ErrorLoadingWithDebug.js"; import { useBankCoreApiContext } from "../context/config.js"; import { useWithdrawalDetails } from "../hooks/access.js"; @@ -92,6 +92,10 @@ export function SolveChallengePage({ newCh.info = resp.body; updateBankState("currentChallenge", newCh); } else { + const newCh = structuredClone(ch); + newCh.sent = AbsoluteTime.now(); + newCh.info = undefined; + updateBankState("currentChallenge", newCh); switch (resp.case) { case HttpStatusCode.NotFound: return notify({ @@ -262,7 +266,7 @@ export function SolveChallengePage({ }} /> {ch.info && ( -
+
-
+
@@ -299,14 +303,8 @@ export function SolveChallengePage({ />
-
- - Cancel - +
+
- {challenge.info ? ( - - ) : ( - - )} -
-
+

+
+ + {challenge.info ? ( + + ) : ( +
sending code ...
+ )} +
); diff --git a/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx b/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx index 0e04ae088..d15420b84 100644 --- a/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx +++ b/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx @@ -172,6 +172,40 @@ export function UpdateAccountPassword({ >
+ {accountIsTheCurrentUser ? ( +
+ +
+ { + setCurrent(e.currentTarget.value); + }} + autocomplete="off" + /> + +
+

+ + Your current password, for security + +

+
+ ) : undefined} +
- {accountIsTheCurrentUser ? ( -
- -
- { - setCurrent(e.currentTarget.value); - }} - autocomplete="off" - /> - -
-

- - Your current password, for security - -

-
- ) : undefined}
diff --git a/packages/demobank-ui/src/pages/admin/AccountForm.tsx b/packages/demobank-ui/src/pages/admin/AccountForm.tsx index de30d473d..c63d602b7 100644 --- a/packages/demobank-ui/src/pages/admin/AccountForm.tsx +++ b/packages/demobank-ui/src/pages/admin/AccountForm.tsx @@ -370,27 +370,29 @@ export function AccountForm({

- { - form.payto_uri = e as PaytoString; - updateForm(structuredClone(form)); - }} - rightIcons={ form.payto_uri ?? defaultValue.payto_uri ?? ""} - />} - value={(form.payto_uri ?? defaultValue.payto_uri) as PaytoString} - disabled={!editableAccount} - /> + {purpose === "create" ? undefined : + { + form.payto_uri = e as PaytoString; + updateForm(structuredClone(form)); + }} + rightIcons={ form.payto_uri ?? defaultValue.payto_uri ?? ""} + />} + value={(form.payto_uri ?? defaultValue.payto_uri) as PaytoString} + disabled={!editableAccount} + /> + }
diff --git a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx index 8773df50a..6b4307417 100644 --- a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx +++ b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx @@ -70,7 +70,7 @@ export function CreateNewAccount({ const resp = await api.createAccount(token, submitAccount); if (resp.type === "ok") { notifyInfo( - i18n.str`Account created with password "${submitAccount.password}". The user must change the password on the next login.`, + i18n.str`Account created with password "${submitAccount.password}".`, ); onCreateSuccess(); } else { @@ -179,7 +179,7 @@ export function CreateNewAccount({

- New business account + New bank account