Provide visual feedback for masked password input #207 #216

pull/225/head
Ryan Kistner 5 years ago
parent 36b9684eb2
commit 08b7911d2d

@ -46,14 +46,20 @@ namespace DepotDownloader
if ( keyInfo.Key == ConsoleKey.Backspace )
{
if ( password.Length > 0 )
{
password.Remove( password.Length - 1, 1 );
Console.Write( "\x1B[1D\x1B[1P" );
}
continue;
}
/* Printable ASCII characters only */
char c = keyInfo.KeyChar;
if ( c >= ' ' && c <= '~' )
{
password.Append( c );
Console.Write( '*' );
}
} while ( keyInfo.Key != ConsoleKey.Enter );
return password.ToString();

Loading…
Cancel
Save