aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-01-11 16:41:24 -0300
committerSebastian <sebasjm@gmail.com>2024-01-11 16:41:42 -0300
commit82d4ed90caa4a6ea3bdda1fb80ccecf3dc3637f9 (patch)
tree59162f0565311e8699ca643a8bd60337ee7f582b /packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
parentca67640f9f94f1150c0fb67c148dc79daa9d3fa0 (diff)
downloadwallet-core-82d4ed90caa4a6ea3bdda1fb80ccecf3dc3637f9.tar.gz
wallet-core-82d4ed90caa4a6ea3bdda1fb80ccecf3dc3637f9.tar.bz2
wallet-core-82d4ed90caa4a6ea3bdda1fb80ccecf3dc3637f9.zip
2fa
Diffstat (limited to 'packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx')
-rw-r--r--packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx21
1 files changed, 13 insertions, 8 deletions
diff --git a/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx b/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
index 0ff1cf725..3c4a865ed 100644
--- a/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
+++ b/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
@@ -9,17 +9,19 @@ import { doAutoFocus } from "../PaytoWireTransferForm.js";
import { ProfileNavigation } from "../ProfileNavigation.js";
import { assertUnreachable } from "../WithdrawalOperationPage.js";
import { LocalNotificationBanner } from "@gnu-taler/web-util/browser";
-import { HttpStatusCode, TalerErrorCode } from "@gnu-taler/taler-util";
+import { AbsoluteTime, HttpStatusCode, TalerErrorCode } from "@gnu-taler/taler-util";
import { useBankState } from "../../hooks/bank-state.js";
export function UpdateAccountPassword({
account: accountName,
onCancel,
onUpdateSuccess,
+ onAuthorizationRequired,
focus,
}: {
onCancel: () => void;
focus?: boolean,
+ onAuthorizationRequired: () => void,
onUpdateSuccess: () => void;
account: string;
}): VNode {
@@ -51,10 +53,11 @@ export function UpdateAccountPassword({
async function doChangePassword() {
if (!!errors || !password || !token) return;
await handleError(async () => {
- const resp = await api.updatePassword({ username: accountName, token }, {
+ const request = {
old_password: current,
new_password: password,
- });
+ }
+ const resp = await api.updatePassword({ username: accountName, token }, request);
if (resp.type === "ok") {
notifyInfo(i18n.str`Password changed`);
onUpdateSuccess();
@@ -77,11 +80,13 @@ export function UpdateAccountPassword({
title: i18n.str`Your current password doesn't match, can't change to a new password.`
})
case HttpStatusCode.Accepted: {
- updateBankState("currentChallengeId", resp.body.challenge_id)
- return notify({
- type: "info",
- title: i18n.str`Cashout created but confirmation is required.`,
- });
+ updateBankState("currentChallenge", {
+ operation: "update-password",
+ id: String(resp.body.challenge_id),
+ sent: AbsoluteTime.never(),
+ request,
+ })
+ return onAuthorizationRequired()
}
default: assertUnreachable(resp)
}