CLIFramework icon indicating copy to clipboard operation
CLIFramework copied to clipboard

Implement PasswordPrompter

Open c9s opened this issue 11 years ago • 1 comments

From issue #3

c9s avatar Oct 02 '14 14:10 c9s

On Linux (CentOS 6.7 and Linux Mint 17.2) even with the use of shell_exec('stty -echo'); the readline function the password prompt was displaying the password.

I was able to fix by altering IO/UnixStty.php and Prompter.php to incorporate code from http://www.dasprids.de/blog/2008/08/22/getting-a-password-hidden-from-stdin-with-php-cli which provides a masking character (*).

If masking isn't required then the following can be used within IO/ReadlineConsole.php in the readPassword function instead of the call to doReadLine

echo $prompt;
$password = fgets(STDIN);
echo "\n";

supton-overtsoftware avatar Dec 18 '15 19:12 supton-overtsoftware