source: LATMOS-Accounts/bin/la-passwd @ 207

Last change on this file since 207 was 207, checked in by nanardon, 15 years ago
  • finish set_password in Ad
  • Property svn:executable set to *
File size: 681 bytes
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use Pod::Usage;
8
9GetOptions(
10    'c|config=s' => \my $config,
11    'b|base=s'   => \my $base,
12    'help'       => sub { pod2usage(0) },
13) or pod2usage();
14
15my $otype = 'user';
16
17my $LA = LATMOS::Accounts->new($config);
18my $labase = $base ? $LA->base($base) : $LA->default_base;
19$labase && $labase->load or die "Cannot load base";
20
21my $obj = $labase->get_object($otype, $ARGV[0]) or do {
22    die "Object $otype $ARGV[0] not found\n";
23};
24if ($obj->set_password($ARGV[1])) {
25    print "Password succefully changed\n";
26    exit 0;
27} else {
28    warn "Error when trying to change password\n";
29    exit 1;
30}
Note: See TracBrowser for help on using the repository browser.