summaryrefslogtreecommitdiff
path: root/bin/xmlrpc-contact_passwd
blob: 1a89d4260ad9f1724ebe63a0a02d3842121e9ec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl

use strict;
use Frontier::Client;
use Data::Dumper;

my( $email, $current_pw, $new_pw ) = @ARGV;

my $uri = new URI 'http://localhost:8080/';

my $server = new Frontier::Client ( 'url' => $uri );

my $login_result = $server->call(
  'FS.ClientAPI_XMLRPC.login',
    'email'    => $email,
    'password' => $current_pw,
);
die $login_result->{'error'}."\n" if $login_result->{'error'};

my $passwd_result = $server->call(
  'FS.ClientAPI_XMLRPC.contact_passwd',
    'session_id'   => $login_result->{'session_id'},
    'new_password' => $new_pw,
);
die $passwd_result->{'error'}."\n" if $passwd_result->{'error'};

warn "Password changed.\n";

1;