Provide visual feedback for masked password input #207 #216

This commit is contained in:
Ryan Kistner committed 2021-06-05 14:18:34 -06:00
1 parent 36b9684eb2
commit 08b7911d2d
1 file changed
+6
+6
View File
@@ -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();