X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=aap-passwd;h=69d892dce8f9c758aceb91881c98314e16c22f29;hb=8443f44e6c18f408210ea542717f8963f8036d0c;hp=68dee6bfd5804429cc13ab1b5a6d407a3190a011;hpb=2630fd34a2e652d05ec16764023046526f11497d;p=apache2-authen-passphrase.git diff --git a/aap-passwd b/aap-passwd index 68dee6b..69d892d 100644 --- a/aap-passwd +++ b/aap-passwd @@ -1,24 +1,27 @@ -#!/usr/bin/perl -wT -use v5.14; +#!/usr/bin/perl -T +use 5.014000; use strict; +use warnings; + +our $VERSION = 0.002001; use Apache2::Authen::Passphrase qw/pwset USER_REGEX/; use IO::Prompter [qw/-e* -stdio/]; -die "Usage: aap-passwd [rootdir] username\n" unless $#ARGV >= 0 && $#ARGV <= 1; -($Apache2::Authen::Passphrase::rootdir) = (shift =~ /(.*)/) if $#ARGV == 1; +die "Usage: aap-passwd [rootdir] username\n" if @ARGV == 0 || @ARGV > 1; +($Apache2::Authen::Passphrase::rootdir) = (shift =~ /(.*)/s) if $#ARGV == 1; my $username = shift; -die "Invalid username" unless $username =~ USER_REGEX; -($username) = ($username =~ /(.*)/); +die "Invalid username\n" unless $username =~ USER_REGEX; +($username) = ($username =~ /(.*)/s); my $passwd = prompt 'Enter new Apache2::Authen::Passphrase password: '; my $confirm = prompt 'Retype new Apache2::Authen::Passphrase password: '; die "Sorry, passwords do not match\n" unless $passwd eq $confirm; pwset $username, $passwd; -say "Password updated successfully"; +say 'Password updated successfully'; ## no critic (RequireCheckedSyscalls) __END__ @@ -82,4 +85,3 @@ along with fonbotd. If not, see =cut -