Skip to content
Snippets Groups Projects
Unverified Commit 60bdaebc authored by Roman Lacko's avatar Roman Lacko
Browse files

install: restore "stty echo" upon receiving SIGINT when asking for password

parent 9becd305
No related branches found
No related tags found
1 merge request!2Restore "stty echo" upon receiving SIGINT when asking for password
......@@ -124,16 +124,27 @@ sub prompt_username {
return $username;
}
sub prompt_password {
print "Enter your faculty password: ";
system("stty -echo");
chomp(my $password1 = <STDIN>);
system("stty echo");
print "\nRepeat your faculty password: ";
sub prompt_secret {
my ($prompt) = @_;
print "$prompt: ";
local $SIG{INT} = sub {
system("stty echo");
exit 1;
};
my $value;
system("stty -echo");
chomp(my $password2 = <STDIN>);
chomp($value = <STDIN>);
system("stty echo");
print "\n";
return $value;
}
sub prompt_password {
my $password1 = prompt_secret("Enter your faculty password");
my $password2 = prompt_secret("Repeat your faculty password");
if ($password1 ne $password2) {
die "[ERROR] Passwords do not match!";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment