Import some changes from the mindcoding branch
[gruntmaster-page.git] / lib / Gruntmaster / Page / Passwd.pm
CommitLineData
31d70015
MG
1package Gruntmaster::Page::Passwd;
2
31d70015 3use Gruntmaster::Page::Base;
31d70015 4use Apache2::Authen::Passphrase qw/pwcheck pwset/;
31d70015
MG
5
6sub generate{
8d29b3b1 7 my ($self, $format, $env) = @_;
31d70015
MG
8 my $r = Plack::Request->new($env);
9 my ($oldpass, $newpass, $confirm) = map {scalar $r->param($_)} 'password', 'new_password', 'confirm_new_password';
10
11 return reply 'Incorrect password' unless eval { pwcheck $r->user, $oldpass; 1 };
12 return reply 'The two passwords do not match' unless $newpass eq $confirm;
13
14 pwset $r->user, $newpass;
15 reply 'Password changed successfully';
16}
17
31d70015 181
This page took 0.010714 seconds and 4 git commands to generate.