From c680f5aa71b08e978444df07f93c381f9d47ab82 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 5 Jun 2023 10:04:09 -0300 Subject: rename aml --- .../aml-backoffice-ui/src/pages/UnlockAccount.tsx | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx (limited to 'packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx') diff --git a/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx b/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx new file mode 100644 index 000000000..2ebac0718 --- /dev/null +++ b/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx @@ -0,0 +1,81 @@ +import { TranslatedString } from "@gnu-taler/taler-util"; +import { notifyError, notifyInfo } from "@gnu-taler/web-util/browser"; +import { VNode, h } from "preact"; +import { UnwrapKeyError } from "../account.js"; +import { createNewForm } from "../handlers/forms.js"; + +export function UnlockAccount({ + onAccountUnlocked, + onRemoveAccount, +}: { + onAccountUnlocked: (password: string) => void; + onRemoveAccount: () => void; +}): VNode { + const Form = createNewForm<{ + password: string; + }>(); + + return ( +
+
+

+ Account locked +

+

+ Your account is normally locked anytime you reload. To unlock type + your password again. +

+
+ +
+
+ { + try { + await onAccountUnlocked(v.password!); + + notifyInfo("Account unlocked" as TranslatedString); + } catch (e) { + if (e instanceof UnwrapKeyError) { + notifyError( + "Could not unlock account" as any, + e.message as any, + ); + } else { + throw e; + } + } + }} + > +
+ +
+ +
+ +
+
+
+ +
+
+ ); +} -- cgit v1.2.3