From b0460b1b8fb61569d20cbd4ac75ae6976bd34a92 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 3 May 2012 18:18:55 +0200 Subject: =?UTF-8?q?=E2=80=98IO::Prompt=E2=80=99=20is=20deprecacted;=20Migr?= =?UTF-8?q?ating=20to=20=E2=80=98IO::Prompter=E2=80=99=20(by=20the=20same?= =?UTF-8?q?=20author).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- INSTALL | 2 +- fripost-adduser | 5 +---- fripost-mkpass | 2 +- fripost-newalias | 2 +- fripost-newdomain | 2 +- fripost-passwd | 4 ++-- lib/Fripost/Password.pm | 4 ++-- lib/Fripost/Prompt.pm | 10 +++++----- 8 files changed, 14 insertions(+), 17 deletions(-) diff --git a/INSTALL b/INSTALL index c8535d8..06fd2ac 100644 --- a/INSTALL +++ b/INSTALL @@ -3,7 +3,7 @@ You need several CPAN modules to use these scripts. If you use Debian GNU/Linux, you can install them like so: sudo aptitude install -R libdatetime-format-mysql-perl libdatetime-perl \ -libdigest-perl libemail-valid-perl libfile-slurp-perl libio-prompt-perl \ +libdigest-perl libemail-valid-perl libfile-slurp-perl libio-prompter-perl \ libmime-base64-perl libmime-lite-perl libnet-ldap-perl \ libstring-mkpasswd-perl libtemplate-perl libyaml-syck-perl diff --git a/fripost-adduser b/fripost-adduser index 168b80c..fc37489 100755 --- a/fripost-adduser +++ b/fripost-adduser @@ -121,7 +121,6 @@ use Getopt::Long qw /:config noauto_abbrev no_ignore_case gnu_compat bundling permute nogetopt_compat auto_version auto_help/; use Pod::Usage; -use IO::Prompt; use MIME::Lite; use MIME::QuotedPrint; use Template; @@ -166,7 +165,6 @@ my ($domain, $login); $username = prompt_email("New username: ", 'is_user'); } ($login, $domain) = split /\@/, $username, 2; - my $maildir = "$domain/$login/Maildir/"; # Trailing slash important my $isActive = 'TRUE'; my ($userPassword, $clearPassword); if ( defined $conf->{password} ) { @@ -174,12 +172,11 @@ my ($domain, $login); } else { $clearPassword = prompt_password(); - $userPassword = hash( undef, undef, $clearPassword ); + $userPassword = hash( $clearPassword ); } $user = { username => $username, - maildir => $maildir, isActive => $isActive, userPassword => $userPassword, }; diff --git a/fripost-mkpass b/fripost-mkpass index c30bd37..c0bf6de 100755 --- a/fripost-mkpass +++ b/fripost-mkpass @@ -41,7 +41,7 @@ $password //= mkpasswd(); # Show the information that will be inserted say "Password: " . $password; -say "Salted SHA-1: " . hash(SHA1, undef, $password); +say "Salted SHA-1: " . hash($password, SHA1, undef); =head1 AUTHORS diff --git a/fripost-newalias b/fripost-newalias index b5ad94f..4d448b7 100755 --- a/fripost-newalias +++ b/fripost-newalias @@ -106,7 +106,7 @@ use Encode qw(encode); use Email::Valid; use Fripost::Prompt; use Fripost::Schema; -use IO::Prompt; +use IO::Prompter; use Getopt::Long qw /:config noauto_abbrev no_ignore_case gnu_compat bundling permute nogetopt_compat auto_version auto_help/; diff --git a/fripost-newdomain b/fripost-newdomain index 6ce7923..1ce4b02 100755 --- a/fripost-newdomain +++ b/fripost-newdomain @@ -117,7 +117,7 @@ use Getopt::Long qw /:config noauto_abbrev no_ignore_case auto_version auto_help/; use Pod::Usage; use Email::Valid; -use IO::Prompt; +use IO::Prompter; use YAML::Syck; ## Get command line options diff --git a/fripost-passwd b/fripost-passwd index 8fad371..4374e47 100755 --- a/fripost-passwd +++ b/fripost-passwd @@ -146,10 +146,10 @@ if (defined $ARGV[0]) { or die "Error: `" .$username. "' is not a valid e-mail.\n"; } else { - $username = prompt_email("New username: ", 'is_user'); + $username = prompt_email("Username: ", 'is_user'); } my $password = $conf->{password}; -$password //= hash( undef, undef, prompt_password() ); +$password //= hash( prompt_password() ); # Ensure that the user exists. diff --git a/lib/Fripost/Password.pm b/lib/Fripost/Password.pm index 53a10f7..fc1f7ce 100755 --- a/lib/Fripost/Password.pm +++ b/lib/Fripost/Password.pm @@ -33,9 +33,9 @@ our @ISA = qw(Exporter); # CRYPT - since it requires salt). # If `$salt' is `undef', the salt is automatically generated, using the # subroutine `&make_salt' below. -sub hash ($$$) { +sub hash { - my ($h, $salt, $pw) = @_; + my ($pw, $h, $salt) = @_; $h //= SHA1; # Treat the schemes that don't use Digest::.. separetely. diff --git a/lib/Fripost/Prompt.pm b/lib/Fripost/Prompt.pm index 95ea7ea..07a1c0b 100755 --- a/lib/Fripost/Prompt.pm +++ b/lib/Fripost/Prompt.pm @@ -14,7 +14,7 @@ our $VERSION = '0.01'; use Data::Dumper; use Email::Valid; use Exporter; -use IO::Prompt; +use IO::Prompter; use Fripost::Password qw/mkpasswd/; our @EXPORT = qw(confirm confirm_or_abort fix_username prompt_email prompt_password); @@ -23,13 +23,13 @@ our @ISA = qw(Exporter); sub confirm { my ($msg) = @_; $msg //= "Is this OK? [no will abort] "; - return prompt $msg, -ynt; + return prompt $msg, -yn; } sub confirm_or_abort { my ($msg) = @_; $msg //= "Is this OK? [no will abort] "; - my $confirmed = prompt $msg, -ynt; + my $confirmed = prompt $msg, -yn; unless ($confirmed) { say "User aborted"; exit 1; @@ -72,8 +72,8 @@ sub prompt_password { my $password; do { - $password = prompt $msg, -e => '*'; - my $confirm = prompt $msg2, -e => '*'; + $password = prompt $msg, -echo => '*'; + my $confirm = prompt $msg2, -echo => '*'; unless ($password eq $confirm) { undef $password; say "Passwords do not match"; -- cgit v1.2.3