diff options
author | Florian Dold <florian@dold.me> | 2022-04-13 13:16:35 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-04-13 13:16:35 +0200 |
commit | 31b6496db502b302e5a33597723ed847a83fe63e (patch) | |
tree | ab1865f78dbfcce89829906b86917f87449837b2 /packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx | |
parent | 2c3aeabed100fb16c33171c005aa41b026eccca1 (diff) | |
download | wallet-core-31b6496db502b302e5a33597723ed847a83fe63e.tar.xz |
anastasis-core: salt rename, fix tagging
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx')
-rw-r--r-- | packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx index bd31fd5bf..ce7b2e545 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx @@ -12,7 +12,7 @@ import { SolveOverviewFeedbackDisplay } from "../SolveScreen"; import { AuthMethodSolveProps } from "./index"; export function AuthMethodTotpSolve({ id }: AuthMethodSolveProps): VNode { - const [answer, setAnswer] = useState(""); + const [answerCode, setAnswerCode] = useState(""); const reducer = useAnastasisContext(); if (!reducer) { @@ -22,10 +22,7 @@ export function AuthMethodTotpSolve({ id }: AuthMethodSolveProps): VNode { </AnastasisClientFrame> ); } - if ( - !reducer.currentReducerState || - reducer.currentReducerState.recovery_state === undefined - ) { + if (reducer.currentReducerState?.reducer_type !== "recovery") { return ( <AnastasisClientFrame hideNav title="Recovery problem"> <div>invalid state</div> @@ -72,11 +69,13 @@ export function AuthMethodTotpSolve({ id }: AuthMethodSolveProps): VNode { for (const ch of chArr) { challenges[ch.uuid] = ch; } - const selectedChallenge = challenges[selectedUuid]; const feedback = challengeFeedback[selectedUuid]; async function onNext(): Promise<void> { - return reducer?.transition("solve_challenge", { answer }); + console.log(`sending TOTP code '${answerCode}'`); + return reducer?.transition("solve_challenge", { + pin: Number.parseInt(answerCode), + }); } function onCancel(): void { reducer?.back(); @@ -96,7 +95,7 @@ export function AuthMethodTotpSolve({ id }: AuthMethodSolveProps): VNode { label="Answer" onConfirm={onNext} grabFocus - bind={[answer, setAnswer]} + bind={[answerCode, setAnswerCode]} /> <div @@ -118,4 +117,3 @@ export function AuthMethodTotpSolve({ id }: AuthMethodSolveProps): VNode { </AnastasisClientFrame> ); } -// NKE8 VD857T X033X6RG WEGPYP6D70 Q7YE XN8D2 ZN79SCN 231B4QK0 |