Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Closed
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.

mattirn added a commit to mattirn/jline3 that referenced this issue Nov 26, 2024
@gnodet gnodet closed this as completed in 8929f9b Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants