aboutsummaryrefslogtreecommitdiffstats
path: root/fripost-passwd
diff options
context:
space:
mode:
authorGustav Eek <gustaveek@student.gu.se>2011-03-14 20:54:34 +0100
committerGustav Eek <gustaveek@student.gu.se>2011-03-14 20:54:34 +0100
commit16ed1260dd2433d9c25cd550a06c175093416f58 (patch)
treec1caa0838e48db7a3b196186e2b8291facf4060f /fripost-passwd
parent0df2709e4588f653fa680f4820dd2d696749723f (diff)
parent68708cd2430d4da548673fd612c891413448fddf (diff)
Merge branch 'master' of https://github.com/skangas/fripost-tools
Diffstat (limited to 'fripost-passwd')
-rwxr-xr-xfripost-passwd21
1 files changed, 5 insertions, 16 deletions
diff --git a/fripost-passwd b/fripost-passwd
index ad835b0..c01ca4b 100755
--- a/fripost-passwd
+++ b/fripost-passwd
@@ -13,22 +13,12 @@ fripost-passwd - Change password of user
use FindBin qw($Bin);
use lib "$Bin/lib";
-our $VERSION = '0.01';
-
use Fripost::Password;
use Fripost::Prompt;
use Fripost::Schema;
use Getopt::Long;
use YAML::Syck;
-my $username = $ARGV[0];
-$username //= prompt_username();
-my $password = prompt_password();
-
-# Show the information that will be inserted
-say "Password: $password";
-say "Salted MD5: " . smd5($password);
-
## Get command line options
our $conf = LoadFile('default.yml');
@@ -39,6 +29,10 @@ GetOptions(
'pretend' => \$conf->{pretend},
) or die "Unable to get command line options.";
+my $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;
@@ -48,17 +42,12 @@ if ($conf->{pretend}) {
my $schema = Fripost::Schema->connect(
$conf->{dbi_dsn}, $conf->{admuser}, $conf->{admpass}, {} #\%dbi_params
);
-
my $row = $schema->resultset('Mailbox')->find($username);
-
-$row->password(smd5($password));
-
+$row->password($password);
$row->update;
say "Updated password for $username.";
-# TODO: ändra changedate vid varje insert
-
=head1 AUTHOR
Stefan Kangas C<< <skangas at skangas.se> >>