diff options
Diffstat (limited to 'packages/anastasis-webui/src/pages')
8 files changed, 16 insertions, 34 deletions
diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx index 11001194a..c4047f0b3 100644 --- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx @@ -274,13 +274,13 @@ export function ChallengeOverviewScreen(): VNode { Policy #{policy_index + 1}: {policyName} </h3> {policy.challenges.length === 0 && ( - <p>This policy doesn't have challenges.</p> + <p>This policy doesn't have any challenges.</p> )} {policy.challenges.length === 1 && ( - <p>This policy just have one challenge.</p> + <p>This policy has one challenge.</p> )} {policy.challenges.length > 1 && ( - <p>This policy have {policy.challenges.length} challenges.</p> + <p>This policy has {policy.challenges.length} challenges.</p> )} {tableBody} </div> diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx index 9ee52d8ed..4f7f21324 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx @@ -44,10 +44,7 @@ export function AuthMethodEmailSolve({ 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> diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx index 3eea9c15f..b58952feb 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx @@ -22,10 +22,7 @@ export function AuthMethodIbanSolve({ 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> diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx index 5f03437af..fcff0b498 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx @@ -43,10 +43,7 @@ export function AuthMethodPostSolve({ 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> diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx index f54f91d92..058efe009 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx @@ -22,10 +22,7 @@ export function AuthMethodQuestionSolve({ 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> diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx index 1fd4343ab..3b00f6f2a 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx @@ -44,10 +44,7 @@ export function AuthMethodSmsSolve({ 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> 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 diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodVideoSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodVideoSolve.tsx index 021589198..e0ebdce76 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodVideoSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodVideoSolve.tsx @@ -23,8 +23,7 @@ export function AuthMethodVideoSolve({ id }: AuthMethodSolveProps): VNode { ); } if ( - !reducer.currentReducerState || - reducer.currentReducerState.recovery_state === undefined + reducer.currentReducerState?.reducer_type !== "recovery" ) { return ( <AnastasisClientFrame hideNav title="Recovery problem"> |