Make Gruntmaster::Page::Base::variants not need overriding
[gruntmaster-page.git] / lib / Gruntmaster / Page / Passwd.pm
CommitLineData
31d70015
MG
1package Gruntmaster::Page::Passwd;
2
3use 5.014000;
4use strict;
5use warnings;
6use Gruntmaster::Page::Base;
7our @ISA = qw/Gruntmaster::Page::Base/;
8our $VERSION = '0.001';
9
10use Apache2::Authen::Passphrase qw/pwcheck pwset/;
11use Plack::Request;
12
13sub generate{
8d29b3b1 14 my ($self, $format, $env) = @_;
31d70015
MG
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
31d70015 251
This page took 0.009917 seconds and 4 git commands to generate.