Bump version and update Changes
[apache2-authen-passphrase.git] / aap-passwd
CommitLineData
7c87e995
MG
1#!/usr/bin/perl -wT
2use v5.14;
3use strict;
4
5use Apache2::Authen::Passphrase qw/pwset USER_REGEX/;
6
7use IO::Prompter [qw/-e* -stdio/];
8
9die "Usage: aap-passwd [rootdir] username\n" unless $#ARGV >= 0 && $#ARGV <= 1;
10($Apache2::Authen::Passphrase::rootdir) = (shift =~ /(.*)/) if $#ARGV == 1;
11
12my $username = shift;
13die "Invalid username" unless $username =~ USER_REGEX;
14($username) = ($username =~ /(.*)/);
15
16my $passwd = prompt 'Enter new Apache2::Authen::Passphrase password: ';
17my $confirm = prompt 'Retype new Apache2::Authen::Passphrase password: ';
18
19die "Sorry, passwords do not match\n" unless $passwd eq $confirm;
20pwset $username, $passwd;
21say "Password updated successfully";
22
23__END__
24
25=head1 NAME
26
27aap-passwd - passwd utility for Apache2::Authen::Passphrase
28
29=head1 SYNOPSIS
30
31 user@hostname:~$ aap-passwd /path/to/rootdir marius
32 Enter new Apache2::Authen::Passphrase password: ***
33 Retype new Apache2::Authen::Passphrase password: ***
34 Password updated successfully
35
36=head1 DESCRIPTION
37
38aap-passwd updates the password of an Apache2::Authen::Passphrase user.
39
40It is used like this:
41
42 aap-passwd /path/to/rootdir username
43
44where the C<rootdir> is the first argument and the username whose password is to be changed is the second argument, or like this:
45
46 aap-passwd username
47
48where the C<rootdir> is taken from the environment and the username is the only argument.
49
50=head1 ENVIRONMENT
51
52=over
53
54=item AAP_ROOTDIR
55
56The default Apache2::Authen::Passphrase C<rootdir>, used if the C<rootdir> is not explicitly given.
57
58=back
59
60=head1 AUTHOR
61
62Marius Gavrilescu C<< <marius@ieval.ro> >>
63
64=head1 COPYRIGHT AND LICENSE
65
66Copyright 2013 Marius Gavrilescu
67
68This file is part of fonbotd.
69
70fonbotd is free software: you can redistribute it and/or modify
71it under the terms of the GNU Affero General Public License as published by
72the Free Software Foundation, either version 3 of the License, or
73(at your option) any later version.
74
75fonbotd is distributed in the hope that it will be useful,
76but WITHOUT ANY WARRANTY; without even the implied warranty of
77MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78GNU Affero General Public License for more details.
79
80You should have received a copy of the GNU Affero General Public License
81along with fonbotd. If not, see <http://www.gnu.org/licenses/>
82
83
84=cut
85
This page took 0.015307 seconds and 4 git commands to generate.