anastasis-webui: display some crude challenge feedback
This commit is contained in:
parent
7d24d2254b
commit
fefdb0d7ad
@ -5,6 +5,38 @@ import { useAnastasisContext } from "../../context/anastasis";
|
|||||||
import { AnastasisClientFrame } from "./index";
|
import { AnastasisClientFrame } from "./index";
|
||||||
import { authMethods, KnownAuthMethods } from "./authMethod";
|
import { authMethods, KnownAuthMethods } from "./authMethod";
|
||||||
|
|
||||||
|
function FeedbackDisplay(props: { feedback?: ChallengeFeedback }) {
|
||||||
|
const { feedback } = props;
|
||||||
|
if (!feedback) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
switch (feedback.state) {
|
||||||
|
case ChallengeFeedbackStatus.Message:
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>{feedback.message}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
case ChallengeFeedbackStatus.Pending:
|
||||||
|
case ChallengeFeedbackStatus.AuthIban:
|
||||||
|
return null;
|
||||||
|
case ChallengeFeedbackStatus.RateLimitExceeded:
|
||||||
|
return <div>Rate limit exceeded.</div>;
|
||||||
|
case ChallengeFeedbackStatus.Redirect:
|
||||||
|
return <div>Redirect (FIXME: not supported)</div>;
|
||||||
|
case ChallengeFeedbackStatus.Unsupported:
|
||||||
|
return <div>Challenge not supported by client.</div>;
|
||||||
|
case ChallengeFeedbackStatus.TruthUnknown:
|
||||||
|
return <div>Truth unknown</div>;
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<pre>{JSON.stringify(feedback)}</pre>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function ChallengeOverviewScreen(): VNode {
|
export function ChallengeOverviewScreen(): VNode {
|
||||||
const reducer = useAnastasisContext();
|
const reducer = useAnastasisContext();
|
||||||
|
|
||||||
@ -98,11 +130,7 @@ export function ChallengeOverviewScreen(): VNode {
|
|||||||
<span class="icon">{method?.icon}</span>
|
<span class="icon">{method?.icon}</span>
|
||||||
<span>{info.instructions}</span>
|
<span>{info.instructions}</span>
|
||||||
</div>
|
</div>
|
||||||
{info.feedback?.state === ChallengeFeedbackStatus.Message ? (
|
<FeedbackDisplay feedback={info.feedback} />
|
||||||
<div>
|
|
||||||
<p>{info.feedback.message}</p>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{method && info.feedback?.state !== "solved" ? (
|
{method && info.feedback?.state !== "solved" ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user