#!/usr/bin/perl use 5.010_000; use warnings; use strict; =head1 NAME fripost-passwd - Change password of user =cut use FindBin qw($Bin); use lib "$Bin/lib"; use Fripost::Password; use Fripost::Prompt; use Fripost::Schema; use Getopt::Long; use YAML::Syck; ## Get command line options our $conf = LoadFile('default.yml'); GetOptions( 'dbi_dsn' => \$conf->{dbi_dsn}, 'admuser=s' => \$conf->{admuser}, 'admpass=s' => \$conf->{admpass}, 'pretend' => \$conf->{pretend}, ) or die "Unable to get command line options."; my $username = fix_username($ARGV[0]); $username //= prompt_email("New username: ", 'is_user'); my $password = prompt_password(); if ($conf->{pretend}) { say "Nothing to do since we are pretending..."; exit 0; } # Connect to the database my $schema = Fripost::Schema->connect( $conf->{dbi_dsn}, $conf->{admuser}, $conf->{admpass}, {} #\%dbi_params ); my $row = $schema->resultset('Mailbox')->find($username); $row->password($password); $row->update; say "Updated password for $username."; =head1 AUTHOR Stefan Kangas C<< >> =head1 COPYRIGHT Copyright 2010 Stefan Kangas. =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as perl itself. =cut