mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
feat: don't hide nonsecret kbd-interactive answers
Some Kbd-Interactive challenges are marked with echo true. For these, it makes sense to use a TextField in place of a PasswordField. This change differentiates between the two options.
This commit is contained in:
parent
2a5857bc3d
commit
af22fd38af
@ -1,7 +1,7 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { GlobalModel } from "@/models";
|
import { GlobalModel } from "@/models";
|
||||||
import { Choose, When, If } from "tsx-control-statements/components";
|
import { Choose, When, If } from "tsx-control-statements/components";
|
||||||
import { Modal, PasswordField, Markdown, Checkbox } from "@/elements";
|
import { Modal, PasswordField, TextField, Markdown, Checkbox } from "@/elements";
|
||||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil";
|
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil";
|
||||||
|
|
||||||
import "./userinput.less";
|
import "./userinput.less";
|
||||||
@ -82,8 +82,17 @@ export const UserInputModal = (userInputRequest: UserInputRequest) => {
|
|||||||
</If>
|
</If>
|
||||||
<If condition={!userInputRequest.markdown}>{userInputRequest.querytext}</If>
|
<If condition={!userInputRequest.markdown}>{userInputRequest.querytext}</If>
|
||||||
</div>
|
</div>
|
||||||
<Choose>
|
<If condition={userInputRequest.responsetype == "text"}>
|
||||||
<When condition={userInputRequest.responsetype == "text"}>
|
<If condition={userInputRequest.publictext}>
|
||||||
|
<TextField
|
||||||
|
onChange={setResponseText}
|
||||||
|
value={responseText}
|
||||||
|
maxLength={400}
|
||||||
|
autoFocus={true}
|
||||||
|
onKeyDown={(e) => handleTextKeyDown(e)}
|
||||||
|
/>
|
||||||
|
</If>
|
||||||
|
<If condition={!userInputRequest.publictext}>
|
||||||
<PasswordField
|
<PasswordField
|
||||||
onChange={setResponseText}
|
onChange={setResponseText}
|
||||||
value={responseText}
|
value={responseText}
|
||||||
@ -91,8 +100,8 @@ export const UserInputModal = (userInputRequest: UserInputRequest) => {
|
|||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
onKeyDown={(e) => handleTextKeyDown(e)}
|
onKeyDown={(e) => handleTextKeyDown(e)}
|
||||||
/>
|
/>
|
||||||
</When>
|
</If>
|
||||||
</Choose>
|
</If>
|
||||||
</div>
|
</div>
|
||||||
<If condition={userInputRequest.checkboxmsg != ""}>
|
<If condition={userInputRequest.checkboxmsg != ""}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
1
src/types/custom.d.ts
vendored
1
src/types/custom.d.ts
vendored
@ -667,6 +667,7 @@ declare global {
|
|||||||
markdown: boolean;
|
markdown: boolean;
|
||||||
timeoutms: number;
|
timeoutms: number;
|
||||||
checkboxmsg: string;
|
checkboxmsg: string;
|
||||||
|
publictext: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UserInputResponsePacket = {
|
type UserInputResponsePacket = {
|
||||||
|
@ -230,6 +230,7 @@ func promptChallengeQuestion(connCtx context.Context, question string, echo bool
|
|||||||
QueryText: queryText,
|
QueryText: queryText,
|
||||||
Markdown: true,
|
Markdown: true,
|
||||||
Title: "Keyboard Interactive Authentication",
|
Title: "Keyboard Interactive Authentication",
|
||||||
|
PublicText: echo,
|
||||||
}
|
}
|
||||||
response, err := userinput.GetUserInput(ctx, scbus.MainRpcBus, request)
|
response, err := userinput.GetUserInput(ctx, scbus.MainRpcBus, request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -22,6 +22,7 @@ type UserInputRequestType struct {
|
|||||||
Markdown bool `json:"markdown"`
|
Markdown bool `json:"markdown"`
|
||||||
TimeoutMs int `json:"timeoutms"`
|
TimeoutMs int `json:"timeoutms"`
|
||||||
CheckBoxMsg string `json:"checkboxmsg"`
|
CheckBoxMsg string `json:"checkboxmsg"`
|
||||||
|
PublicText bool `json:"publictext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*UserInputRequestType) GetType() string {
|
func (*UserInputRequestType) GetType() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user