Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

InputValue prompt with mask doesn't return the enter value, only the repeated mask character #1103

Open
fkirchhoff opened this issue Oct 25, 2024 · 2 comments
Milestone

Comments

@fkirchhoff
Copy link

This example illustrates the problem:

        Terminal terminal = TerminalBuilder.builder().system(true).build();
        ConsolePrompt consolePrompt = new ConsolePrompt(terminal);
        PromptBuilder builder = consolePrompt.getPromptBuilder().createInputPrompt()
                .name("secret").message("secret>").mask('*').addPrompt();
        Map<String, PromptResultItemIF> answer = consolePrompt.prompt(builder.build());
        System.out.println("secret:"+answer.get("secret").getResult());

will result in:

? secret> ****
secret:****

even though I entered 1234.

@gnodet gnodet added this to the 3.27.2 milestone Oct 27, 2024
@ericparton
Copy link

I'm also seeing the same issue

@fkirchhoff
Copy link
Author

As I was trying to fix the issue locally (in the absence of #1068), I noticed that ConsolePrompt copies the prompt value to be echoed back, which would result displaying the non-masked value.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants