Last change
on this file was
1640,
checked in by nanardon, 8 years ago
|
Add basic functions for anonymous password reset
|
-
Property svn:executable set to
*
|
File size:
859 bytes
|
Rev | Line | |
---|
[1640] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use LATMOS::Accounts; |
---|
| 6 | use Getopt::Long; |
---|
| 7 | use Pod::Usage; |
---|
| 8 | use Term::ReadKey; |
---|
| 9 | use Crypt::RSA; |
---|
| 10 | |
---|
| 11 | =head1 NAME |
---|
| 12 | |
---|
| 13 | la-crypt-passwd - Tools to managed rsa crypted password in LATMOS Account system |
---|
| 14 | |
---|
| 15 | =head1 SYNOPSIS |
---|
| 16 | |
---|
| 17 | la-crypt-passwd [options] username |
---|
| 18 | |
---|
| 19 | =cut |
---|
| 20 | |
---|
| 21 | GetOptions( |
---|
| 22 | 'c|config=s' => \my $config, |
---|
| 23 | 'help' => sub { pod2usage(0) }, |
---|
| 24 | 'base=s' => \my $base, |
---|
| 25 | ) or pod2usage(); |
---|
| 26 | |
---|
| 27 | =head1 OPTIONS |
---|
| 28 | |
---|
| 29 | =over 4 |
---|
| 30 | |
---|
| 31 | =item -c|--config configdir |
---|
| 32 | |
---|
| 33 | Use this configuration directory instead of the default one. |
---|
| 34 | |
---|
| 35 | =back |
---|
| 36 | |
---|
| 37 | =cut |
---|
| 38 | |
---|
| 39 | my $LA = LATMOS::Accounts->new($config, noacl => 1); |
---|
| 40 | my $labase = $LA->base($base); |
---|
| 41 | $labase && $labase->load or die "Cannot load base"; |
---|
| 42 | $labase->wexported(1); |
---|
| 43 | |
---|
| 44 | my ($username, $url) = @ARGV; |
---|
| 45 | |
---|
| 46 | my $user = $labase->get_object('user', $username); |
---|
| 47 | |
---|
| 48 | $user->SendPasswordReset($url); |
---|
| 49 | $user->base->commit; |
---|
Note: See
TracBrowser
for help on using the repository browser.