projects
/
clearscm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
179f424
)
Changed to properly handle backspace when entering passwords
author
Andrew DeFaria
<Andrew@DeFaria.com>
Fri, 16 Oct 2020 16:36:23 +0000
(09:36 -0700)
committer
Andrew DeFaria
<Andrew@DeFaria.com>
Fri, 16 Oct 2020 16:36:23 +0000
(09:36 -0700)
lib/Utils.pm
patch
|
blob
|
history
diff --git
a/lib/Utils.pm
b/lib/Utils.pm
index
8aabcaa
..
29e020c
100644
(file)
--- a/
lib/Utils.pm
+++ b/
lib/Utils.pm
@@
-341,10
+341,9
@@
Returns:
=cut
-
$prompt ||= 'Password';
- my $password;
+ my $password
= ''
;
local $| = 1;
@@
-365,9
+364,18
@@
Returns:
last;
} # if
- print '*';
+ # Handle backspaces
+ if ($key eq chr(127)) {
+ unless ($password eq '') {
+ chop $password;
+
+ print "\b \b";
+ } # unless
+ } else {
+ print '*';
- $password .= $key;
+ $password .= $key;
+ } # if
} # while
ReadMode 'restore'; # Reset tty mode before exiting.