]> iEval git - gruntmaster-page.git/blame_incremental - lib/Gruntmaster/Page/Passwd.pm
Make Gruntmaster::Page::Base also act as strict/warnings/feature/etc
[gruntmaster-page.git] / lib / Gruntmaster / Page / Passwd.pm
... / ...
CommitLineData
1package Gruntmaster::Page::Passwd;
2
3use Gruntmaster::Page::Base;
4use Apache2::Authen::Passphrase qw/pwcheck pwset/;
5
6sub generate{
7 my ($self, $format, $env) = @_;
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
181
This page took 0.017761 seconds and 4 git commands to generate.