source: trunk/LATMOS-Accounts/bin/la-sql-reset-passwd @ 1659

Last change on this file since 1659 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
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use Pod::Usage;
8use Term::ReadKey;
9use 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
21GetOptions(
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
33Use this configuration directory instead of the default one.
34
35=back
36
37=cut
38
39my $LA = LATMOS::Accounts->new($config, noacl => 1);
40my $labase = $LA->base($base);
41$labase && $labase->load or die "Cannot load base";
42$labase->wexported(1);
43
44my ($username, $url) = @ARGV;
45
46my $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.