]> iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Passwd.pm
Add X-Forever
[gruntmaster-page.git] / lib / Gruntmaster / Page / Passwd.pm
1 package Gruntmaster::Page::Passwd;
2
3 use 5.014000;
4 use strict;
5 use warnings;
6 use Gruntmaster::Page::Base;
7 our @ISA = qw/Gruntmaster::Page::Base/;
8 our $VERSION = '0.001';
9
10 use Apache2::Authen::Passphrase qw/pwcheck pwset/;
11 use Plack::Request;
12
13 sub generate{
14 my ($self, $format, $env) = @_;
15 my $r = Plack::Request->new($env);
16 my ($oldpass, $newpass, $confirm) = map {scalar $r->param($_)} 'password', 'new_password', 'confirm_new_password';
17
18 return reply 'Incorrect password' unless eval { pwcheck $r->user, $oldpass; 1 };
19 return reply 'The two passwords do not match' unless $newpass eq $confirm;
20
21 pwset $r->user, $newpass;
22 reply 'Password changed successfully';
23 }
24
25 sub variants{ [[reply => 1, undef, undef, undef, undef, undef]] }
26
27 1
This page took 0.046849 seconds and 4 git commands to generate.