69374e8dd30dc62646b318a99f944dfce2c01162
7 use Plack
::Middleware
::Auth
::Complex
;
10 say STDERR
"$0 USERNAME [DSN [DB_USER [DB_PASSWD]]]";
14 my ($username, $dsn, $dbuser, $dbpasswd) = @ARGV;
15 $dsn //= $ENV{AUTHCOMPLEX_DSN
};
16 $dbuser //= $ENV{AUTHCOMPLEX_DBUSER
};
17 $dbpasswd //= $ENV{AUTHCOMPLEX_DBPASSWD
};
23 my $password = prompt
'Password: ', -echo
=> '*', -in => *STDIN
;
24 my $confirm = prompt
'Confirm password: ', -echo
=> '*', -in => *STDIN
;
26 if ($password ne $confirm) {
27 say STDERR
'The passwords do not match';
31 my $ac = Plack
::Middleware
::Auth
::Complex
->new({
32 dbi_connect
=> [$dsn, $dbuser, $dbpasswd]
36 $ac->set_passphrase($username, $password) or die "$@\n";
37 say 'Password changed successfully';
46 authcomplex-passwd - change user password
50 authcomplex-passwd USERNAME [DSN [DB_USER [DB_PASSWD]]]
53 authcomplex-passwd myuser # dsn defaults to 'dbi:Pg:'
54 authcomplex-passwd myuser 'dbi:Pg:dbname=www-data'
55 authcomplex-passwd myuser 'dbi:Pg:dbname=www-data' db_superuser password123
59 B<NOTE: This script does not support scrypt passphrases.>
61 The authcomplex-passwd script changes the password for an user.
62 Takes one mandatory argument, the user whose password should be changed.
64 The DBI Data Source Name is the second argument to the script, or the
65 value of the AUTHCOMPLEX_DSN environment variable if set, or
68 The username for the database is the third argument to the script, or
69 the value of the AUTHCOMPLEX_DBUSER environment variable if set, or an
70 empty string otherwise.
72 The password for the database is the fourth argument to the script, or
73 the value of the AUTHCOMPLEX_DBPASSWD environment variable if set, or
74 an empty string otherwise.
78 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
80 =head1 COPYRIGHT AND LICENSE
82 Copyright (C) 2015-2017 by Marius Gavrilescu
84 This library is free software; you can redistribute it and/or modify
85 it under the same terms as Perl itself, either Perl version 5.20.1 or,
86 at your option, any later version of Perl 5 you may have available.
This page took 0.025537 seconds and 4 git commands to generate.